1 bodyApp.controller('customersCtrl', function ($scope, $http, cfpLoadingBar,$compile) { 2 $scope.test = function(){ 3 alert('test'); 4 } 5 6 // TODO 動態生成html中 ng-click無效 解決方法 $compile 是傳進來的 7 var html = '<a href="javascript:void(0);" ng-click="$scope.test();"></a>' 8 $("body").append($compile(html)($scope)); 9 });
