leonsPAPA
leonsPAPA

Reputation: 797

How to pass html script variable to controller?

Just a quick question. Suppose I obtain values for var name and size in html <script> tag like this example, how can I pass them to angularJS controller?

Many Thanks.

Upvotes: 0

Views: 53

Answers (1)

jstuartmilne
jstuartmilne

Reputation: 4488

So This is NOT an elegant solution but you can use it as a global variable but you can do

window.myVar = varinScript;

and in the controller use/asign the window.myVar to a controller variable

Hope it helps

Upvotes: 1

Related Questions