Can you try by declaring person object outside of the function.
On Tuesday, December 15, 2015 at 11:47:11 AM UTC+5:30, Paperless wrote:
>
> Problem: The first line is not picking up the persons name "<label>Hello
> {{person.first}} </label>"
> ----------------
>
> index.html
> ---------
> <body>
> <section>
> <div ng-app="myApp" ng-controller="myCtrl">
> <label>Hello {{person.first}} </label>
> <div>
> First Name: <input type="text" ng-model="firstName">
> </div>
> <div>
> Sir Name : <input type="text" ng-model="sirName"><br />
> <br>
> </div>
> <button ng-click="sendName()">Submit</button>
> </div>
> </section>
> </body>
>
>
> --Script file--
> app.controller('myCtrl', function ($scope, $http) {
> $scope.firstName = "1";
> $scope.sendName = function () {
>
> console.log($scope.firstName);
>
> $scope.person = {};
> $scope.person.first = $scope.firstName;
> };
> }
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.