W
W
WebDev2015-05-08 12:30:47
Angular
WebDev, 2015-05-08 12:30:47

Angular. How to call a method from a script?

Tell me how to do it right:
There is a controller and a view, in the form I edit the product, one of the parameters is edited through the slider (jQuery UI). How to keep track of its values ​​as the slider is moved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WebDev, 2015-05-08
@kirill-93

We assign an id to the block with the controller and access the methods through it:
angular.element(document.getElementById('productsCtrl')).scope().method();

V
Vladimir, 2015-05-10
@telray

In fact, the correct way for Angular is to write a directive for the slider and through it already attach to the data.
https://github.com/angular-ui/ui-slider
Accessing elements directly is not a good way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question