@RequestMapping(value = "/SubmitStep1.json", method = RequestMethod.POST, headers = "Accept=application/json,application/xml")
@ResponseBody
public List<ShopDetails> showShopList(@RequestBody ShopDetails shopDetails)throws Exception{
List<ShopDetails> shopDetailsList=new ArrayList<ShopDetails>();
shopDetailsList=dbq.getShopDetails(shopDetails);
return shopDetailsList;
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我将返回商店列表,其中包含每个商店的详细信息.
所以,我的问题是,如果我得到商店列表,我可以在返回时添加成功/错误消息.
无法访问homeController(模块控制器).点击"home"链接获取控制台上的错误"homeController不是一个函数;未定义.
那么,我需要注册这个控制器谢谢,Rahul
twoPageApp.js
* Created by rahul on 9/24/2016.
*/
(function(){
angular.module("twoPageApp",["ngRoute"])
.config(function($routeProvider){
$routeProvider
.when('/home',{
templateUrl:'/JS/twoPageAppJS/partials/home.html',
controller: 'homeController',
resolve:{
homeContent:['$http',function($http){
return $http.get('/homeContent.json');
}]
}
})
.when('/page_one',{
templateUrl:'/Js/twoPageAppJS/partials/pageOne.html',
controller:'pageOneController',
resolve:{
homeContent:['$http',function($http){
return $http.get('/pageOneContent.json');
}]
}
})
.when('/page_two',{
templateUrl:'/JS/twoPageAppJS/partials/pageTwo.html',
controller:'pageTwoController.js',
resolve:{
homeContent:['$http',function($http){
return $http.get('/pageTwoContent.json');
}]
}
})
});
})();
Run Code Online (Sandbox Code Playgroud)
twoPageApp.Controller.js
(function(){
angular.module("twoPageApp").controller("tpaController",
['$scope',function($scope){
$scope.name="this is twoPageApp js controller";
}])
})();
Run Code Online (Sandbox Code Playgroud)
module COntroller(homeController.js)
/**
* Created by rahul on 9/24/2016.
*/
(function(){
angular.module("twoPageApp",[]) //here is the change...
.controller("homeController",['$scope','$rootScope','homeContent',function($scope,$rootScope,homeContent){
$rootScope.stub={
homeContent:homeContent.data
};
$scope.hello="rahul";
console.log("raja"); …Run Code Online (Sandbox Code Playgroud)