AngularJS - Scope value not accessible in the directive Scope

前端 未结 6 1463
梦谈多话
梦谈多话 2021-01-26 09:01

FIDDLE

I have created a directive :-

return {
        restrict: \'EAC\',
        scope: {
            statesActive: \'=\'
        },            
                 


        
6条回答
  •  深忆病人
    2021-01-26 10:07

    Try using this to access your scope.

    return {
        ...
        link: function (scope, element, attrs) {
            ....
            scope.$parent.$parent.YourVariable;
        }
    };
    

    And I think you need to change your HTML to this:

    
    

提交回复
热议问题