angular.module('gdsApp').directive('modalDialog', function($http,$location) {
return {
restrict: 'E',
scope: {
show: '=',
selectFn: '&callbackFn'
},
transclude: true, // Insert custom content inside the directive
link: function(scope, element, attrs) {
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
scope.init = function () {
alert(' inii');
};
var urlBase=$location.absUrl().split('/#/')[0];
scope.showLookUpTable = false;
scope.hideSearchResults = function() {
scope.showLookUpTable = false;
};
},
templateUrl: 'pages/LookUpModal.html'
};
});
<div class='ng-modal' ng-show='show'>
<div class='ng-modal-overlay'></div>
<div class='ng-modal-dialog' ng-style='dialogStyle'
ng-init="hideSearchResults()">
<div class='ng-modal-dialog-content'>
<div class="col-md-12">
<h3>Organisation Name Lookup</h3>
<hr style="border-top:1px solid darkblue"/>
</div>
</div>
嗨,
我有ng-init
个功能ng-init=hideSearchResults()
。但是在加载html页面时函数没有调用。如何在加载时从html页面的自定义指令中调用函数。请帮帮我。