AngularJS ng-controller not working

UiUx

I just now started learning on AngularJS from w3schools. I am trying to practice examples what ever they have mentioned in the tutorials. Every thing works fine but when i came to "AngularJS Controllers" it is not working properly as working well in w3schools Try it Yourself ». I ve forked my code into this fiddle example. My script looks like this:

function personController($scope) {
    $scope.firstName= "John";
    $scope.lastName= "Doe";
}

Try to help me out and suggest me a good tutorial(or any free pdf file).

Kutyel

This is your corrected fiddle.

It is a good practice for angular that the controller definition must look something like this:

angular.module("app", []).controller("personController", function($scope) {
    $scope.firstName = "John";
    $scope.lastName = "Doe";
});

And, without doubt, the best tutorial ever for learning the basics of Angular is the CodeSchool one!

Hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AngularJS ng-click not working with configured Controller

From Dev

AngularJS beginner: ng-controller not working

From Dev

AngularJS ng-controller not working after bootstraping

From Dev

AngularJs ng-if function call from same controller not working

From Dev

AngularJS - Controller Function Not Working w/ng-click

From Dev

AngularJs ng-if function call from same controller not working

From Dev

AngularJS controller $scope not working inside ng-if directive

From Dev

AngularJS Controller not working in nested Controller

From Dev

AngularJS greetController Controller not working

From Dev

angularjs 1.3 controller as not working

From Dev

multiple controller not working in angularjs

From Dev

AngularJS controller not working

From Dev

angularjs 1.3 controller as not working

From Dev

AngularJS greetController Controller not working

From Dev

AngularJS - Toaster not working in Controller

From Dev

ng-if (Angularjs) is not working

From Dev

AngularJs ng show not working

From Dev

Angularjs data-ng-controller

From Dev

"Controller as" not working with ng-repeat

From Dev

AngularJS : ng-include and ng-controller

From Dev

Angularjs - data binding not working with controller

From Dev

Angularjs $setPristine not working with controller as syntax

From Dev

Show and Hide Controller not working, AngularJS

From Dev

Simple AngularJS Controller Demo Not Working

From Dev

AngularJS ng-model not working?

From Dev

ng-checked is not working in angularjs

From Dev

AngularJS : ng-disable not working

From Dev

ng-submit not working in angularjs

From Dev

Angularjs predicate on ng-if is not working