javascript - Click on the category list and get products using category id in angularjs -
i using intelxdk application. mobile application.
my categorylist show, after click on that, have redirect product page, when click on category can error 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) { }); }]);
Comments
Post a Comment