douke6027
2015-02-25 10:09
浏览 46
已采纳

我使用Chrome在angularjs中运行我的控制器时遇到问题

I am battling with this code run on crome then it has been throw the following error.but everything is working fine in firefox

1)Uncaught SyntaxError: Unexpected token }
2)Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.28/$injector/modulerr?p0=lens_admin&p1=Erro…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.28%2Fangular.min.js%3A18%3A170)

inside my Controller:

 angular.module('lens_admin.controllers', ['angularFileUpload']).
.controller('adminController', function($scope,$http,$location,$upload) {
$scope.brand_edit_submit = function(bid) {
var brand_type_editObj=new Object();
brand_type_editObj.edit_mode='brand';
brand_type_editObj.bid=bid;
brand_type_editObj.brand_type_edit=$scope.brand_type_edit;
$http.post("ajax/frame_list_update.php",{brand_type_editObj}).  //first error focus here.am i correct to passing Object to server side..
success(function(data, status, headers, config) {
alert(data);
$scope.brand_type_tables();
$scope.lens_brand_table();
$('.modal').modal('hide');
}).
error(function(data, status, headers, config) {
alert("Please Try Again..!");
});
}
});

i have embedded files for "angularFileUpload" module that included in my "admin.controllers".what is wrong with my code.this issue occured only in crome..any one can give me some ideas.. Thanks Advance..

图片转代码服务由CSDN问答提供 功能建议

我正在使用此代码在crome上运行然后它已抛出以下错误。但一切都是 在firefox中正常工作

  1)Uncaught SyntaxError:Unexpected token} 
2)Uncaught Error:[$ injector:modulerr] http://errors.angularjs。 组织/ 1.2.28 / $注射器/ modulerr P0 = lens_admin&安培; P1 = ERRO ... gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.28%2Fangular.min.js%3A18%3A170)
  <  / pre> 
 
 

在我的控制器内:

  angular.module('lens_admin.controllers',['angularFileUpload']  )。
.controller('adminController',函数($ scope,$ http,$ location,$ upload){
 $ scope.brand_edit_submit = function(bid){
var brand_type_editObj = new Object(); 
brand_type_editObj。  edit_mode ='brand'; 
brand_type_editObj.bid = bid; 
brand_type_editObj.brand_type_edit = $ scope.brand_type_edit; 
 $ http.post(“ajax / frame_list_update.php”,{brand_type_editObj})。//第一个错误焦点在这里。 我是否正确通过O.  bject to server side .. 
success(function(data,status,headers,config){
alert(data); 
 $ scope.brand_type_tables(); 
 $ scope.lens_brand_table(); 
 $('。  modal')。modal('hide'); 
})。
error(function(data,status,headers,config){
alert(“Please Try Again ..!”); 
}); 
  } 
}); 
   
 
 

我有“angularFileUpload”模块的嵌入文件,包含在我的“admin.controllers”中。我的代码有什么问题。这个 问题只发生在crome ..任何人都可以给我一些想法.. 谢谢提前..

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongwei1855 2015-02-25 10:24
    已采纳

    This is the error line:

    $http.post("ajax/frame_list_update.php",{brand_type_editObj})
    

    This is because

    {brand_type_editObj}
    

    Isn't a proper object.

    It needs to be

    { someName: brand_type_editObj }
    

    Where I have introduced a key someName. JavaScript objects are key/value pairs. So there always needs to be a Key and there always needs to be a Value.

    2)Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.28/$injector/modulerr?p0=lens_admin&p1=Erro…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.28%2Fangular.min.js%3A18%3A170)

    This occured because it probably couldn't find ['angularFileUpload']. But with out seeing the main script its hard to know for sure

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题