为什么是$scope.orderBy
未定义的?不应该是“测试”吗?
var app = angular.module("Foo", []);
app.directive("two", function () {
return {
scope: {
orderBy: '@'
},
restrict: 'E',
transclude: true,
controller: function ($scope, $element, $attrs) {
console.log($scope.orderBy); // is undefined, why?
},
template: '<div></div>',
replace: true
};
});
<div ng-app="Foo">
<two order-by="test">test</two>
</div>