I am new to Angular and in learning phase. I am not sure if this is the 
appropriate forum to ask questions, but here it goes. I am having a comment 
box and am trying to display the count of char that I typed in it. The 
following code does not give me the count but the one commented does so
==================JS=============
var myApp=angular.module("myApp",[]);
myApp.controller("myController",["$scope",function($scope){
    $scope.commentText="";
   /* $scope.lenghtComment=function(){
        return $scope.commentText.length;
    };*/
    $scope.lengthComment=$scope.commentText.length;

}]);
=========================================
<!doctype html>
<html>
    <head lang="en">
        <meta charset="utf-8"/>        
        <title>Practice</title>
    </head>
    <body ng-app="myApp">
        <div ng-controller="myController">
            Enter your text <br>
            <textarea rows="5" id="comments" 
ng-model="commentText"></textarea>
            <br>
            Type Char:{{ lenghtComment }}   <!--   Type Char:{{ 
lenghtComment() }}    -->  
        </div>        
        <script 
src="https://code.angularjs.org/1.5.0-beta.2/angular.min.js"; 
type="text/javascript"></script>
        <script src="prac.js" type="text/javascript"></script>
    </body>
    
</html>

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