Hi folks,
I'm converting an application that is using ngRoute. I know few ngRoute
variables and its equivalent in ui-router
Here are few that I know
$location.path = $stage.go
$routeProvider = $stateProvider
What about $routeParams, what is the equivalent in ui-router?
Hopefully someone can convert this code using ui-router.
$scope.$on(
"$routeChangeSuccess",
function ($currentRoute, $previousRoute) {
if ($routeParams.name) {
$scope.selectName($routeParams.name);
} else {
$scope.selectFirst();
}
$scope.action = $routeParams.action;
if ($scope.action === 'code') {
if (!$scope.selected.code) {
$q.all([$http.get($scope.selected.xmlUrl),
$http.get($scope.selected.jsonUrl)])
.then(function (data) {
var xml = data[0],
json = data[1];
$scope.selected.code = {
json: JSON.stringify(json, undefined, 2),
xml: xml.data
};
});
}
}
}
);
Thanks!
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.