慕盖茨4494581
123456789101112131415161718192021222324252627282930313233343536373839
testvar myApp = angular.module("myApp", []);myApp.directive('testIt',function(){return {restrict: 'A',scope: false,link:function(scope, elm, attr){if(scope.$last){elm.css('color','red');scope.myFunction();}}}});myApp.controller("testCtrl", function($scope){$scope.items = [0,1,2,3,4];$scope.myFunction = function(){console.log('Hello!');};});- {{item}}