1
我有兩個自定義指令,如下所示:app1
和app2
。只有當我點擊app1
中的特定按鈕時,纔會顯示app2
。我能做到這一點的最佳方式是什麼?從另一個指令加載一個指令
這裏是我的代碼:
module.directive('app1', function() {
// Runs during compile
return {
restrict: 'E',
link: function(scope, element, attrs,controller) {
var filter = scope.getFilters(attrs.appname);
},
templateUrl: '../directives/filter/partials/filter.html' ,
controller: "filterCtrl"
};
});
module.module('app2').directive('dmView', function() {
return {
restrict: 'E',
controller: 'viewController',
link: function(scope, element, attrs) {
var viewData = scope.getViewData(attrs.appname);
var options = {
forceFitColumns: false,
enableColumnReorder: false
}
var grid;
grid = new Slick.Grid('#myGrid', viewData.data, viewData.columns, options);
scope.grid = grid;
},
templateUrl: '../directives/view/partials/view.html'
};
});