小编Rah*_*mar的帖子

如何在返回对象列表作为响应时添加成功/错误标志

在此输入图像描述在此输入图像描述

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

在上面的代码中,我将返回商店列表,其中包含每个商店的详细信息.

所以,我的问题是,如果我得到商店列表,我可以在返回时添加成功/错误消息.

java spring-mvc

7
推荐指数
1
解决办法
576
查看次数

angular.js:13708错误:[ng:areq]参数'homeController'不是函数,未定义

无法访问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)

javascript json angularjs angular-routing

5
推荐指数
1
解决办法
747
查看次数

标签 统计

angular-routing ×1

angularjs ×1

java ×1

javascript ×1

json ×1

spring-mvc ×1