$state.go not working on device


#1

Hello.

My appli working on chrome but not when i try on ionic platform, on android. I use $state.go when i use the search bar then, i swtich to a view result.

My controller :

.controller('ResultCtrl', ['$scope', '$http', '$state', '$location',
  function($scope, $http, $state, $location) {
    $scope.$watch("query.length", function(val) {
		if (val > 0) {
			$state.go('restult');
			$scope.init();
		}
		if (val == 0) {
			$state.go('accueil');
		}
		$scope.init = function() {
			$http({
				url: 'http://melanie-croce.fr/projets/app-back/public/api/v1/videos',
				method: "GET",
				}).success(function(videos) {
					$scope.videos = videos;
					console.log(videos)
				});
		}
	});
  }
])

I did a search bar, when I do my research, it changes my view for the search results. it works fine on browser but on device, the result page does not display at all when I write. I’m doing research, but no solution … is the probleme that I use $state.go in a controller? I do not know and I hope that’s not the problem …

Thanks.


#2

This looks like ionic 1. You might wanna change the category of the topic to ionic 1 :slight_smile: Also ‘not working’ is quite a wide statement to use. More details will likely get you more/better answers.

  • What are you trying to do?
  • What are the steps to reproduce the problem?
  • What have you tried yourself.

And please align/indent your code properly, its hard to read if you dont show it properly.


#3

Sorry, i’m a newbie, i edit my post, thanks !


#4

Solved! Stupid mistake in my router, I have “templateURL 'templates / result.html” instead of" templateURL ‘Templates / restult.html’"