javascript - ng change with custom directive -



javascript - ng change with custom directive -

javascript code directive

angular.directive('uidatepicker', [function() { homecoming { restrict: 'ea', scope: { ngmodel: '=ngmodel', ngchange: '=ngchange' }, templateurl: 'complete/date-picker.tmp.html', replace: true, require: 'ngmodel', link: function(scope, elem, attrs, ngmodel) { if(scope.ngmodel !== undefined) { scope.datepicker = new datepicker(new date(scope.ngmodel)); } else { scope.datepicker = new datepicker(); } scope.ngmodel = scope.datepicker.value; } } }])

javascript code controller

angular.controller('main', ['$scope', function($scope) { $scope.change = function(value) { console.log(value); }; $scope.value = 1000; }])

html code

<div ng-controller="main"> <ui-date-picker ng-model="date" ng-change="change(value)"></> </div>

and question: how ng-change work ?. ngmodel still work !

javascript angularjs angularjs-directive

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -