Skip to content

Initializing model using a Global function doesn't seem to work for me? #14

@darshakmehta

Description

@darshakmehta

What is going wrong here ?

<!doctype html>
<html lang="en" data-ng-app>
<head>
    <meta charset="utf-8">
    <title>AngulasJS Demo3</title>
    <script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
    <script>
        function nameController($scope){
            $scope.firstname = 'John';
            $scope.lastname = 'Smith';
        }
    </script>
</head>
<body data-ng-controller = "nameController">
First Name : <input type = "text" data-ng-model="firstname"></input> 
<br />
<br />
Last Name : <input type = "text" data-ng-model="lastname"></input> 
<br />
<br />
Hello {{ firstname }} {{lastname}}

</body>
</html>

demo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions