Apply for Zend Framework Certification Training

AngularJs





 Hi viewers in this blog we will see how we can use angular 1.7 
to display data in HTML. We will be using a text file to 
display data in HTML.

create a file  data.txt
       [ {  "Name" : "Mahesh Parashar",
            "RollNo" : 101,
            "Percentage" : "80%"
         },{ "Name" : "Dinkar Kad",
             "RollNo" : 201,
             "Percentage" : "70%"
         },{ "Name" : "Robert",
             "RollNo" : 191,
             "Percentage" : "75%"
        },{"Name" : "Julian Joe",
           "RollNo" : 111,
          "Percentage" : "77%"  }]
        Create A index.html file
<!script>
function studentController($scope,$http) {
   var url="data.txt";
   $http.get(url).success( function(response) {
           $scope.students = response;
    });
}
</script>
<script src="angular.min.js"></script>
<h2>AngularJS Sample Application</h2>
<div ng-app="" ng-controller="studentController">
<table>
   <tr>
          <th>Name</th>
          <th>Roll No</th>
	  <th>Percentage</th>
   </tr>
   <tr ng-repeat="student in students">
          <td>{{ student.Name }}</td>
          <td>{{ student.RollNo }}</td>
	  <td>{{ student.Percentage }}</td>
   </tr>
</table>
</div>
                                    

< How to get First Word using angularjs How to use multiple module in same script in angularjs >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top