我想从不同的指令中读取初始值 ngModel.$viewValue。
# coffee script
app.directive 'directive', ->
return {
require: '?ngModel',
link: (scope, element, attrs, ngModelCtrl) ->
........
console.log(ngModelCtrl.$viewValue) # does give NaN!
ngModelCtrl.$setViewValue('something'); # only after setting reading does work
console.log(ngModelCtrl.$viewValue)
我真的很感激任何帮助。