Why is my fiddle not working?

2019-08-01 06:34发布

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条回答
等我变得足够好
2楼-- · 2019-08-01 07:03

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"
查看更多
登录 后发表回答