AngularJS : directives and scope

后端 未结 4 1595
无人及你
无人及你 2021-01-21 01:39

I have a simple question that I think has a pretty simple solution, but somehow I am missing it.

I\'m setting up a simple directive for my app. I\'m leaving the scope pr

4条回答
  •  伪装坚强ぢ
    2021-01-21 02:10

    Here is the code working with Ng 1.2:

    http://jsfiddle.net/roadprophet/PfEaz/

    MyDirectives.directive("mdPagination", function(){
        console.log('BLAH');
        return {
            template: "

    BLAH!

    ", replace: true, restrict: 'A', scope: false, //default link: function(scope, element, attrs){ console.log('in linking function'); console.dir(scope); console.dir(element); console.dir(attrs); console.dir(scope['pages']); } } });

    Notice I am injecting $scope into the controller.

提交回复
热议问题