I am having problems with using ng-blur
in a custom directive. What I want is to be able to make a component that can handle any type of function sent into the ng-blur
attribute on the directive.
Here is the directive example:
<az-dir ng-blur="change()" lid="test" ng-model="obj.test"></az-dir>
Javascript directive
app.directive('azDir', azDir);
function azDir() {
return {
restrict: 'E',
scope: {
ngModel: '=',
ngBlur: '=',
lid: '@'
},
templateUrl: 'directive.html',
replace: true,
require: 'ngModel'
};
}
Simple angular controller:
var app = angular.module('ashtest', []);
app.controller('TopCtrl', ['$scope',
function($scope) {
$scope.obj = {
test: "Ashkan"
};
$scope.change = function() {
$scope.obj.test = "changedThis";
}
}
]);