javascript - unable to call $stateProvider, twice to update the view (it is only working for the first time) -
i have search books page, in when click search tab, depending on search criteria, display results in adjacent block. when click second time, not working!
the relevant html code of page:
<form action="#" method="post" ng-controller = "optionscontroller octrl"> <select class="selectpicker btn btn-default" name="searchcriteria" id ="soptions"> <option value="1">title</option> <option value="2">author</option> </select> <label class="searchbox"> <span><br></span> <textarea id="searchbox" name="searchbox" value="" type="text" autocomplete="on" placeholder="search books"></textarea> </label> <input type="button" value="search" id = "bsearch" class="submit button" ui-sref = ".searchresults"> </form> <div id = "spaceforresults" ui-view = "" autoscroll="false"> </div>
my angular js code routing
routerapp.config(function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/home'); $stateprovider .state('books.searchresults', { url: '', templateurl: 'html/searchresults.html', controller: 'bookcontroller', });
so, when click search button, results popped out expected. if change options , click search button again, not routing view (updating results). doing wrong on here?
reload
just set state reload true example below
$state.go($state.current, {}, {reload: true}); //second parameter $stateparams
taken here please give original author props.
Comments
Post a Comment