なぜ$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>