I am using AngularJS and I created a directive that requires 'ngModel':
'use strict';
angular.module('spot.im.embed').directive('sayBox', ['$sce', '$timeout', '$parse',
function($sce, $timeout, $parse) {
return {
restrict: 'EA',
require: 'ngModel',
scope: {
},
link: function(scope, iElement, iAttrs, ngModel) {
ngModel.$viewValue = 'adasd';
}
}
}
]);
For reasons I don't know, the ng-model changes doesn't impact the view. Why is that? Is this the right way to change the ngModel value from a directive?