I want to pass some values from one view to another in Angularjs using ui-Router.
I don\'t want to use $rootScope to save data or create a new services ( as I have many view
Since you have specified the approach that you wanted to follow, you should create the following
$stateProvider
.state('view2', {
url: "/view2/:param1/:param2",
templateUrl: 'view2.html',
controller: function ($stateParams) {
console.log($state.params.param1+"-"+$state.params.param2);
}
});
and from where ever you want to call
$state.go('view2',{param1:'10', param2:'2'});
But in general it is advised that you keep these values in a service or some where stored. With the application growing you may have to use few more attributes to compute