Roque Orts Roque Orts - 26 days ago 9
AngularJS Question

Get parameters url angular when run app

Is there a way to get params in AngularJs 1.4 when the app runs, when the params come from get method? ex: http://www.myapp.com/whatever?param1=1234
I mean just here in my app.js file:

var myApplication = angular.module('App', [ui.router,...])
.run(function ($rootScope,$http,....){
var param = // I wish to read the param here
}


If not is possible, how can I get it using a controller?
Thanks

Answer

Good morning, Using $location.search() returns an object with the paramenters.Thanks!