angular js scope property is undefined

Posted by user2071301 on Stack Overflow See other posts from Stack Overflow or by user2071301
Published on 2013-06-30T16:14:32Z Indexed on 2013/06/30 16:21 UTC
Read the original article Hit count: 356

why is $scope.orderBy undefined? Shouldnt it be "test" ?

http://jsfiddle.net/XB4QA/4/

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>

© Stack Overflow or respective owner

Related posts about angularjs

Related posts about angularjs-directive