‘argument ‘FirstCtrl’ is not a function, got undefined’.

Published on Author Code Father

You have to specify the name inĀ ng-app directives in your html.
Lose the one in your div.

Update
Let’s try a different approach.
Define a module in your js file and assign the ng-appdirective to it. After that, define the controller like an ng component, not as a simple function:

<div ng-app="myAppName"><!  
-- or what's the root node of your angular app -->

and the js part:

angular.module('myAppName', []).
    controller('FirstCtrl', function($scope) {
         $scope.data = {message: 'Hello'};});
    

Here’s an online demo that is doing just that : http://jsfiddle.net/FssbL/1/

Comments

comments