Tuesday 17 September 2019

javascript - I need to get products when I clicked on the category list

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) {

});

}]);

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...