Why is my fiddle not working?

十年热恋 提交于 2019-12-11 04:56:22

问题


This is just broken and I can't figure out why. The TodoCtrl function appears unrecognised and yet there are many examples of this working.

https://jsfiddle.net/r0pk793e/15/

I have tried both:

angular.module('App', []).controller("Ctrl", ['$scope', function($scope){

And:

function TodoCtrl($scope) {

All to no avail.


回答1:


You just need to change this:

angular.module('App', []).controller("Ctrl", ['$scope', function($scope){

To this:

angular.module('App', []).controller("TodoCtrl", ['$scope', function($scope){

And put information in your ng-app like so:

ng-app="App"


来源:https://stackoverflow.com/questions/42369395/why-is-my-fiddle-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!