Skip to content

Instantly share code, notes, and snippets.

@fabrizim
Created April 28, 2017 17:23
Show Gist options
  • Save fabrizim/e5bac41737b95a60e94cdad368b3e9c1 to your computer and use it in GitHub Desktop.
Save fabrizim/e5bac41737b95a60e94cdad368b3e9c1 to your computer and use it in GitHub Desktop.
Search Form Handler
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);
}
});
}
};
@davidmcatee-azure
Copy link

It looks like this is working now.

@davidmcatee-azure
Copy link

Try replacing https://gist.github.com/fabrizim/e5bac41737b95a60e94cdad368b3e9c1#file-search-js-L11-L12 with

var $state = $injector.get('$state');
$state.go('blogPage', { path: '?' + data });

@fabrizim
Copy link
Author

fabrizim commented May 1, 2017

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