AngularJS未捕获ReferenceError:控制器未从模块定义
发布时间:2020-12-17 08:15:48 所属栏目:安全 来源:网络整理
导读:我有以下代码 var app = angular. module("myApp",[]). config(function($routeProvider,$locationProvider) { $routeProvider.when('/someplace',{ templateUrl: 'sometemplate.html',controller: SomeControl }); // configure html5 to get links working
我有以下代码
var app = angular. module("myApp",[]). config(function($routeProvider,$locationProvider) { $routeProvider.when('/someplace',{ templateUrl: 'sometemplate.html',controller: SomeControl }); // configure html5 to get links working on jsfiddle $locationProvider.html5Mode(true); }); app.controller('SomeControl',...); 我收到以下错误 Uncaught ReferenceError: SomeControl is not defined from myApp 问题只是我无法使用app.controller(‘SomeControl’,…)语法?当使用$ routeProvider?是唯一的工作语法: function SomeControl(...)
使用引号:
controller: 'SomeControl' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |