I can't get this simple Angular example to work.
I'm getting Uncaught Error: [$injector:modulerr] Failed to instantiate module app
HTML:
<div ng-app="app" ng-controller="Example">
<input type="text" placeholder="#1 Main Odd"
ui-blur="testfn('data.mainOdd1', $event, '#1 Main Odd');">
</div>
Javascript:
angular
.module('app', [])
.directive('uiBlur', function($parse) {
return function(scope, elem, attrs) {
elem.bind('blur', function(event) {
scope.$apply(function() {
$parse(attrs.uiBlur)(scope, {
$event: event
});
});
});
};
})
.controller('Example', function($scope) {
$scope.testfn = function(propertyName, $event, placeHolder) {
debugger;
console.log(propertyName, $event);
};
});
What am I doing wrong here?
Thanks