让我们来看看我的指令:
angular.module('main').directive('datepicker', [
function() {
return {
require: '?ngModel',
link: function(scope, element, attributes, ngModel) {
ngModel.$modelValue = 'abc'; // this does not work
// how do I change the value of the model?
Run Code Online (Sandbox Code Playgroud)
那么,我该如何改变ng模型的值呢?