S
S
Sergey Nikolaev2015-06-18 21:03:10
JavaScript
Sergey Nikolaev, 2015-06-18 21:03:10

How to correctly pass an array from $scope to a directive?

How to correctly accept such a transfer from $scope
vm.data - an array
<div tx-chart information="vm.data"></div>

//директива
link: function(scope, element, attr) {
attr.information //выводит vm.data
}

If vm.data is wrapped in {{}}, returns as a string.
How to pass an array correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kononenko, 2015-06-18
@Devastor

//директива
scope: {information: "=information"},
link: function(scope, element, attr) {
  scope.information //выводит массив
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question