我仅在缩小代码(生产)上收到此错误。当我在表单中添加“控制器”功能时创建了错误。请查看我的代码,也许你会看到一些错误。任何提示都会很有用;)
依赖项:“angular-formly”:“~7.1.2”,“angular-formly-templates-bootstrap”:“~6.1.0”,
我的控制器代码:
.controller('NSearchBoxOnResultsController', ($rootScope) ->
@formFields =
[
type: 'form_with_own_classes'
key: 'q'
defaultValue: @resultAsValue
templateOptions:
type: 'string'
label: ''
placeholder: I18n.t('homepage.placeholder')
wrapper_class: 'row input--primary modal__center-items search search_query'
input_container_class: 'col-xs-12'
onKeypress: ($viewValue, $modelValue, scope, event) =>
if event?.which == 13
@submit()
controller: ($scope, $rootScope) =>
@scope = $scope
@rootScope = $rootScope
@rootScope.$on('$locationChangeSuccess', (newValue, oldValue) =>
if @scope.options?.formControl
@hash = window.location.hash.split('/')
@queryFromHash = @hash.slice(2, @hash.length).join('/')
@resultAsValue = decodeURIComponent(@queryFromHash)
@scope.options.formControl.$setViewValue(@resultAsValue)
@scope.options.formControl.$rollbackViewValue()
)
]
@submit = =>
window.location = "/search/#all/#{@search.q}"
@
)