Search code examples
angularjsgoogle-chromejsfiddle

Why is my fiddle not working?


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.


Solution

  • 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"