Reputation: 2364
I'm trying to get ng-model-options
to work and set it via a binding. However it doesn't seem to work when it's set in the controller.
EG:
This works but I don't want to pass it a string
input.current-page(type='text' ng-model='pageNumber.value' ng-model-options='{getterSetter: true}')
My attempt:
This returns Cannot read property 'updateOn' of undefined
link: function(scope) {
scope.modelOpts = { getterSetter: true }
})
// view
input.current-page(type='text' ng-model='pageNumber.value' ng-model-options='modelOpts')
Upvotes: 0
Views: 1962
Reputation: 2364
Interestingly in a directive you cannot set ng-model-options
within link
. When used in the controller its fine.
// This Will Work
controller: function($scope) {
$scope.modelOpts = {
getterSetter: true
}
},
// This Will Not Work
link: function(scope) {
scope.modelOpts = {
getterSetter: true
}
},
Upvotes: 6