Click here to Skip to main content
14,700,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using Intelxdk for this application. This is a mobile application.

My categorylist will show, after that click on that, I have to redirect the product page, When I click on the category I can get some error like this. "Can't find variable: $state;

CategoryController.js

app.controller('CategoryController', ['$scope','getServices','JSONDataService', function($scope,getServices,JSONDataService) {
  var url = 'http://look4what.biz/mobile/shop-category.php';
  
    $scope.getId = function(termid){
    JSONDataService.addTansferData(termid);
        $state.go('/:id');
   }
   getServices.sendRequest(url)
            .success(function(data, status, headers, config) {
     $scope.userslists = data;
   })
   .error(function(data, status, headers, config) {

            });
  
}]);


app.js

 var app = angular.module('LookApp', ['ionic','ngCordova','ngRoute','paymentCtrls']);

app.config(function($stateProvider, $urlRouterProvider,$routeProvider) {
  $routeProvider
  
   .when('/', {
    controller: 'CategoryController',
    templateUrl: 'views/category.html'
  })
  
  .when('/:id', {
    controller: 'ProductController',
    templateUrl: 'views/users.html'
  })

 .when('/login/:friendId', {
    controller: 'LoginController',
    templateUrl: 'views/login.html'
  })
 
  .otherwise({
    redirectTo: '/'
  });
});


ProductController.js

  app.controller('ProductController', ['$scope', '$routeParams', 'category','JSONDataService','getServices', function($scope, $routeParams, category,JSONDataService,getServices) {
  
 $scope.newData = JSONDataService.getTansferData();
    
   term_id="+$scope.newData;
   var url = "http://look4what.biz/mobile/id-get-detail.php?term_id="+termid;
   getServices.sendRequest(url)
            .success(function(data, status, headers, config) {
     $scope.userslists = data;
   })
   .error(function(data, status, headers, config) {

            });
}]);




What I have tried:

I am using Intelxdk for this application. This is a mobile application.

My categorylist will show, after that click on that, I have to redirect the product page, When I click on the category I can get some error like this. "Can't find variable: $state;

I have to know how to create app.js file for for the $stateProvider also.
Posted
Updated 3-Jul-16 19:49pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900