首页 > 代码库 > ngModel

ngModel

https://docs.angularjs.org/error/ngModel/numfmt?p0=sa


angular.module(‘myApp‘, []).directive(‘tagList‘, [function () { return { require: ‘ngModel‘, link: function (scope, elem, attrs, ngModel) { var toView = function (val) { return (val || []).join(‘, ‘); }; var toModel = function (val) { return (val || ‘‘).split(‘,‘).map(function (v) { return v.trim(); }); }; ngModel.$formatters.unshift(toView); ngModel.$parsers.unshift(toModel); } };}]);

 

ngModel