2

I have a form that has a number of dependent parameters fields. That is, changing one parameters field value may cause a server request to repopulate the other parameter fields. After the user sets all of the fields they will press a button and launch in a popup window a new form running the report they specified.

To get the URL for this window I need to make one final call to the server which will return the formatted URL (using GET). So the resultant flow on button click is:

  • Gather values from fields
  • Call web service to construct URL. (I will use a promise)
  • Launch open.window with new URL

The first 2 steps are straight-forward, but I am unsure on how to handle the window.open from the controller. Any thoughts or ideas?

P.S. I thought about using a directive to overwrite the link URL as values changes, but having to go back to server to construct the URL after each parameter changed seems like way too much processing.

1
  • Ignore this. I found $window and all is well with $window.open() Somedays ...... Commented Apr 14, 2014 at 20:51

1 Answer 1

2

Sorry for wasting people's time. The answer is $window.open() from the controller.

Sign up to request clarification or add additional context in comments.

2 Comments

Actually you could have used window.open() as well.I don't know what puzzled you. (Ofcourse using $window is preferrable, e.g. from a testability point of view)
It just plain doesnt work in ng-click which sucks, but in controller is working perfect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.