I have the following return of an directive in angularJS
return {
restrict: _restrict,
link: function (scope, element, attrs) {
$timeout(LinkPre, 0); //Calling a scoped method
},
templateUrl: ConstrutorapiTemplatesChart,
scope: "@",
controller: Controller
}
My LinkPre function is the function below
var LinkPre = function (scope, elem, attrs) {
attrs.$observe(_attrUrl, function (relatorio) {
if (relatorio != "") AoMudarUrl(scope, elem, relatorio);
});
}
I got an error on the LinkPre function, that the attrs is undefined
Cannot read property '$observe' of undefined
Anyone has any ideia why?
Obs: I need that the Link function be executed after the directive is rendered