V
V
vohaha2014-10-17 21:34:34
Angular
vohaha, 2014-10-17 21:34:34

What is the best way to write behavior logic in Angular.js?

The bottom line is that there are 2 buttons to select something. And based on which button was pressed, the submit button should use the 1st or 2nd controller. Well, or one controller, but choose the 1st or 2nd address of the post request. Can this be done with angular or via if?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Starostin, 2014-10-17
@Lixoradka

Actually, what prevents you from hanging a handler in the controller on each button and in this handler assigning one or another value to some variable from the scope of the controller, and when you need to submit the form, take the address from the scope parameter.
Or am I missing something in the question?

S
Sergey, 2014-10-17
Protko @Fesor

Can this be done with angular

Can.
You just decide whether the submit button, submit the form, 1 or 2 controllers, why it should decide something else about the address of the POST request, if everything boils down to choosing the first or second controller action (or two controllers).
Try to formulate the question a little less abstractly and perhaps you can answer it yourself.
ps I can't help feeling that you're trying to do something bad...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question