How does angularJs keep filter so that it is still enable when history back -
Just like an example of angularJs :, the filter can not be placed in angular j, so after receiving filter results , And then click one of the mobile to see in detail and then click behind the browser, the filter will disappear. I am thinking, is there any way we can use to keep the filter?
Thank you Jhang, but it seems this is a jQuery method I have found solution using angular JS. Simply put, when you type the search string, you archive the filter in $ Root Scope, and then set it back while loading the view. See the code below:
// Controller function xxxController ($ rootScope, $ scope) {// set saved search string back model $ scope.SearchModel = $ rootScope.searchString; $ Scope.saveSearchString () = function () {$ rootScope.searchString = $ scope.SearchModel; } See // & lt; Input type = "text" ng-change = "savesearchstring ()" ng-model = "SearchModel" & gt; Perhaps you want to empty the saved search string when you click on some links, you can reset $ root.Scope.searchString to empty. E.g.
// Other control function other controller ($ rootScope, $ scope) {$ scope.resetContext = function () {$ rootScope.searchString = ""; }} // View & lt; A href = "/ data" ng-click = "resettext ()" & gt; Clicks & lt; / A & gt; There is hope for someone to help.
Comments
Post a Comment