Looking to extract variables from the URL and assign them to scope variables. The URL format might be altered, but for example:
http://example.com?opt.val=true&eg=foobar
The controller code in consideration is as follows:
m.controller('maps', function ($scope) {
$scope.opts = {
val: false,
lav: false
};
$scope.eg = "Hello, World!";
});
The goal is to extract opt.val=true&eg=foobar
from the URL and set the respective controller variables accordingly:
$scope.opt.val = true;
$scope.eg = "foobar";
$scope.lav = false;
Seeking an efficient method using Angular or any better alternative instead of resorting to parsing and manually assigning each variable in the scope. Any suggestions?
If further clarification is needed, feel free to request more information.