Colleen Caffey
Colleen Caffey

Reputation: 13

Angular is not defined error

I am trying to create a login page and I have the html looking how I want it so now I am trying to create a controller but for some reason the js controller isnt working with the html. here is the plunker. The {{name}} data bind should display world but it isnt. Here is the controller:

(function() {
    "use strict";
    var app = angular.module('plunker', []);

    app.controller('LoginController', function($scope) {
        $scope.name = 'World';
    });

})();

http://plnkr.co/edit/mqc6ksw1xo7NMhj74Noa?p=preview

Upvotes: 0

Views: 1800

Answers (2)

Sajeetharan
Sajeetharan

Reputation: 222722

The issue is your angularjs link is not working , just replace with this,

  <script data-require="angular.js@*" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.min.js"></script>

Working code

Upvotes: 3

Tim
Tim

Reputation: 43364

You have the wrong link so it can't load angular, change

https://code.angularjs.org/2.0.0-alpha.31/angular.js

to

https://code.angularjs.org/2.0.0-alpha.31/angular2.js

note the extra '2' at the end

Upvotes: 0

Related Questions