I have a text box with a search Button as below
On clicking the search button, I am calling SearchController.search method and my expectation is it will display a new page with the result.
$scope.search = function () { $http.get('data/results.json').success(function (data) { $scope.activities = data; $state.go('results',data); }); and my app.js looks as below
var myApp = angular.module('MyApp', ['ui.router']); myApp.config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('results', { url: '/results', templateUrl: 'result.html', controller: 'SearchController' }); $urlRouterProvider.otherwise('/'); }); But when I click on search button, nothing happens and url only changes to l/#/results .
I am not having any ui-view in search page and I want to go results page to display the result. How to get this fixed? what is the mistake I am doing?
$state.go("result", {name: data.name});and your state url likeurl:'/results?name'and everything will be fine. but it's different.