1
我必須花費幾個指令組件。 但事實上我並不完全改變。 在這種情況下,可以用下面的指令來完成。如? 非常感謝。指令組件Angular 1.5x
(function() {
'use strict';
angular
.module('01')
.directive('tableSortable', tableSortable);
/** @ngInject */
function tableSortable() {
return {
restrict: 'E',
transclude: true,
templateUrl: 'app/components/tabla/tableSortable.html',
scope: {
columns: '=',
data: '=',
sort: '=',
click: '&'
},
link: function(scope) {
scope.selectedClass = function(columnName) {
return columnName == scope.sort.column ? 'sort-' + scope.sort.descending : false;
};
}
};
} })();
沒有渲染任何東西,我必須做其他事情才能使它工作。謝謝 –
您使用的是controllerAs語法還是純$作用域?另外,讓我看看你的html teplate。 –
就是這樣,我修好了。謝謝。 –