1
我只在缩小代码(生产)上出现此错误。 “角formly”:)未知提供者:tProvider < - t
相关性;当我里面添加formly .. “控制器”功能,请看我的代码,也许你会看到一些bug .. 任何提示,将是有益的 错误创建“〜7.1.2”, “角formly模板的自举”: “〜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}"
@
)
但是,当我不注入在主控制器$ rootScope formly也在努力 - 但同样的错误。我认为注入主控制器没有改变任何东西.. – Darex1991
'控制器:['$ scope','$ rootScope',($ scope,$ rootScope)=> {}]'。你应该查找ng-annotate。它会为你处理所有这些。 – j2L4e
tnx帮助;) – Darex1991