angularjs - angular ui router state with search elements -


Main question: Is it possible to use $ state.go () with custom search elements By $ location.search (e, v) ? Or maybe I need to use $ location.path () to use such a code?

Why do I need it: I have a view, selects with some (all of them have a default value), and it would be nice if every change in the location changed to those options Will be (partners / partners / list? Branch = branch01 & amp; role = seller ). But by using $ state.go () I can only use $ stateParams (which is defined within the state URL) - but it does not satisfy me And I want to do a job that changes the state directly into FE / partners / list? Role = sellers .

I would like a solution to use the $ location.search (e, v) because all the parameters are optional, so I can not create a state that searches for the search criteria Any set of can take.

you .go ()

  // Here is a skeleton app. Build your own from this crappy fork, or scratch. Var app = angular Module ('display', '[ui.router']); App.config (function ($ stateProvider) {$ stateProvider.state ({name: 'home', url: '/ home? Param1 & amp; param2', administrator: function ($ scope, $ stateparms, $ state) {$ Scope $ StateParams = $ stateParams;}, Template: 'State Parameter: 
'});}); // State change hooks; The log for the console is called App.run (function ($ state, $ rootsecope, $ location) {$ rootScope.someparams = function () {$ state.go ('home', {param1: 'foo', param2: 'bar' }};}; $ RootScope.otherparams = function () {$ state.go ('home', {param1: 'wat', param2: 'oy!'});}; $ RootScope.location = $ location.url ; $ RootScope $ $ ($ $ LocationChangeSuccess), function (avit, extra) {$ rootScope.location = additional;});});  
  & lt; Script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "https://rawgit.com/angular-ui/ui-router/0.2.11/release/angular-ui-router.js" & gt; & Lt; / Script & gt; & Lt; Body ng-app = "display" & gt; & Lt; A href = "#" ng-click = "somewhat ()" & gt; Some parameters & lt; / A & gt; & Lt; A href = "#" ng-click = "OtherParam ()" & gt; Other parameters & lt; / A & gt; & Lt; Div ui-view & gt; UI-view is not populated & lt; / Div & gt; & Lt; Pre & gt; {{Location}} & lt; / Pre & gt; & Lt; / Body & gt;  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -