Click here to Skip to main content
15,896,542 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
html code not accessing script code

What I have tried:

HTML
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

<body>
    <div ng-app="myApp" ng-controller="myController">
        
        First Name :<input type="text" data-ng-model="FirstName" />
        Last Name :<input type="text" data-ng-model="LastName" />
        <br />
        Full Name :{{FirstName+" "+LastName}}
    </div>
    <script>
        var app = angular.module('myApp', []);
        app.controller('myController', function ($Scope) {
            $Scope.FirstName = "Gadhe";
            $Scope.LastName = "Srinu";
        }
        );
    </script>
</body>
</html>




output
First Name :textbox
Last Name :textbox

Full Name :{{FirstName+" "+LastName}}
Posted
Updated 25-May-16 8:21am
v3

1 solution

try this
HTML
<html>
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myController">
    First Name :<input type="text" data-ng-model="FirstName" />
    Last Name :<input type="text" data-ng-model="LastName" />
    Full Name :{{FirstName+" "+LastName}}

    <script>
        var app = angular.module('myApp', []);
        app.controller('myController', function ($scope) {
            $scope.FirstName = "Gadhe";
            $scope.LastName = "Srinu";
        }
        );
    </script>
</body>
</html>


ng-app and ng-controller attribute is missing.
$scope should be lowercase
refer the angular js inside head tag.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900