有谁知道AngularJS的IP地址掩码插件?
因为我试图使用"Jquery输入IP地址控件",但它不起作用.当我尝试使用它时,"ngModel"属性不会获得文本字段的值.在屏幕中我可以看到文本字段内的值,但是,如果我在元素中执行".value()",则返回""值.当我通过使用console.log()看到$ scope元素的值时,会发生同样的事情.
谁能帮我?
谢谢!
编辑:已解决
人,问题解决了.
我在http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController中使用了这个指令:
app.directive('contenteditable', function() {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
link: function(scope, element, attrs, ngModel) {
if(!ngModel) return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function() {
element.html(ngModel.$viewValue || '');
};
// Listen for change events to enable binding
element.bind('blur keyup change', function() {
scope.$apply(read);
});
read(); // initialize
// Write …Run Code Online (Sandbox Code Playgroud)