Created
April 28, 2017 17:23
-
-
Save fabrizim/e5bac41737b95a60e94cdad368b3e9c1 to your computer and use it in GitHub Desktop.
Search Form Handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ = jQuery; | |
module.exports = { | |
init : function(){ | |
$(document).on('submit', 'form.searchform', function(e){ | |
if( window.angular ){ | |
e.preventDefault(); | |
var $form = $(e.currentTarget); | |
var data = $form.serialize(); | |
var $injector = angular.element( $('html')[0] ).injector(); | |
var $location = $injector.get('$location'); | |
$location.path("/healthy-living/?"+data); | |
} | |
}); | |
} | |
}; |
Try replacing https://gist.github.com/fabrizim/e5bac41737b95a60e94cdad368b3e9c1#file-search-js-L11-L12 with
var $state = $injector.get('$state');
$state.go('blogPage', { path: '?' + data });
Cool. I did that and it is working for me now. However, the "?" in the query string is escaped in the location bar.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like this is working now.