S
S
Sergey Nikolaev2015-07-06 13:55:12
JavaScript
Sergey Nikolaev, 2015-07-06 13:55:12

How to run a directive in angular after receiving a value from the server?

Send to directive
<div index index="vm.rating"></div>
Receive to directive

scope:{
                index: '='
            },
            link: function(scope, element, attr) {
                console.log(scope.index); //возвращает undefined, потому что запрос не успевает отработать 
            }

how to make the directive run only when the request returns data in vm.rating ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2015-07-06
@Devastor

<div index index="vm.rating" ng-if="vm.look_Ma_Iam_Ready"></div>

P
Pavel Kononenko, 2015-07-06
@premas

You cannot duplicate attributes. Remove one index.

<div index="vm.rating" ng-if="vm.look_Ma_Iam_Ready"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question