角未捕获的对象 [英] Angular Uncaught Object

查看:117
本文介绍了角未捕获的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的角所以我仍然得到我的头围绕它是如何工作的。我迷迷糊糊了一个问题(然而很早就...)及以下的code是给我未捕获对象在控制台和休息角。该部分的.config是罪魁祸首,如果我将其删除,页面加载罚款。我不完全知道如何错误被造成的,因为对我来说,一切都看起来不错?

  VAR应用= angular.module('应用',['ngRoute'])    的.config(['$ routeProvider','$ locationProvider',函数($ routeProvider,$ locationProvider){
        $ routeProvider
            。当('/仪表板',{
                templateUrl:/app/views/admin.html',
                控制器:'DashboardController
            })
            。除此以外('/', {
                redirectTo:'/'
            })        $ locationProvider.html5mode(真);
    }])    .controller('DashboardController',['$范围',函数($范围,安全性){
        $ scope.security =安全;
    }])


解决方案

我有同样的错误;如果激活Chrome浏览器停留在异常,你就可以有更详细的错误信息

I'm new to Angular so i'm still getting my head around how it works. I've stumbled into a problem however (quite early on...) and the below code is giving me "Uncaught Object" in the console and breaks Angular. The .config section is the culprit, if I remove it, the page loads fine. I'm not entirely sure how the error is being caused because to me, everything looks fine?

var app = angular.module('app', ['ngRoute'])

    .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
        $routeProvider
            .when('/dashboard', {
                templateUrl: '/app/views/admin.html',
                controller: 'DashboardController'
            })
            .otherwise('/', {
                redirectTo: '/'
            })

        $locationProvider.html5mode(true);
    }])

    .controller('DashboardController', ['$scope', function ($scope, Security) {
        $scope.security = Security;
    }])

解决方案

I had the same error; if you activate Chrome to pause on exceptions, you'll be able to have more detailed error information

这篇关于角未捕获的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆