javascript - Angular with querystring -


** angular newbie alert **

i have web page called several querystring values.

i populate couple of data binding areas values coming in querystring.

<span class="username">{{firstname}}{{lastname}}</span> 

and parsing querystring using this

  var vars = [], hash;   var q = document.url.split('?')[1];   if (q != undefined) {     q = q.split('&');     (var = 0; < q.length; i++) {       hash = q[i].split('=');       vars.push(hash[1]);       vars[hash[0]] = hash[1];     }   }    alert(vars['lastname']); 

i not sure how drive values data binding fields.

use $location provider angular.

you can var searchobject = $location.search();

then key of object. searchobject.lastname

angular.controller("ctrl",['$location',function($location){ /**ctrl code **/

}]);