WHY ANGULARJS CONTROLLER IS NOT WORKING PROPER?

Linda Perla

Total Post:13

Points:93
Posted by  Linda Perla
 1054  View(s)
Ratings:
Rate this:

Hi I’m new new in Angularjs library I’m begin to learn AngularJs Controller but my Controller is not work

My AngularJs Controller Code:

mainApp.controller('employeeController', function ($scope) {

        $scope.employee = {

            firstName: "Kamlakar",

            lastName: "Singh",

            fullName: function () {

                var studentObject;

                employeeObject = $scope.employee;

                return employeeObject.firstName + " " + employeeObject.lastName;

            }

        };

    });

My AngularJs Html Code:

<div ng-app=" " ng-controller="employeeController">

 

Enter first name: <input type="text" ng-model="employee.firstName"><br><br>

Enter last name: <input type="text" ng-model="employee.lastName"><br>

<br>

You are entering: {{employee.fullName()}}

</div>

Where is problem I can’t understand please solve my problem as soon as possible.

Thank you in Advance:

  1. Jessica James

    Post:16

    Points:114
    Re: Why AngularJs Controller is not Working proper?


    You have missed the code for initialize angularjs application code


    Try this code:

    Controller Code:

    This code write first line

    var mainApp = angular.module("mainApp", []);

    Html Code:

    <div ng-app=" " ng-controller="employeeController">…</div>

      Modified On Mar-18-2016 11:19:25 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!