What’s the explanation for it not working the other way?

De: [email protected] [mailto:[email protected]] Em nome de 
Paperless
Enviada em: terça-feira, 15 de dezembro de 2015 06:32
Para: AngularJS
Assunto: [AngularJS] Re: first name not printing from object that stores data 
in controller

yeah. it worked.

On Tuesday, 15 December 2015 12:23:44 UTC+5:30, Akshath Kumar wrote:
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]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

-- 
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.

Reply via email to