how to call more than 100 products of data in Angular Js - need some dynamically data driven solution



I am new in Angular JS. Creating some product list searchable gallery via Angular JS.


My all the products data is in same js file which doesn't a good solution. I want all of the data dynamic driven or want to call via jSON or XML.


Can anyone plz guide me, below is the sample code:


HTML:



<!doctype html>
<html lang="en" ng-app="phonecatApp">
<head>
<meta charset="utf-8">
<title>Gallery</title>
<link rel="stylesheet" href="../bootstrap.css">
<link rel="stylesheet" href="../app.css">
<script src="../angular.js"></script>
<script src="../controllers.js"></script>
</head>
<body ng-controller="PhoneListCtrl">
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<!--Sidebar content-->

Search: <input ng-model="query">

</div>
<div class="col-md-10">
<!--Body content-->

<ul class="phones">
<li ng-repeat="phone in phones | filter:query">
{{phone.name}}
<p><img src={{phone.img}}></p>
<p>{{phone.snippet}}</p>
</li>
</ul>

</div>
</div>
</div>

</body>
</html>


JS



'use strict';

/* Controllers */

var phonecatApp = angular.module('phonecatApp', []);

phonecatApp.controller('PhoneListCtrl', function($scope) {
$scope.phones = [
{'img': 'images/img.gif',
'name': 'Nexus S',
'snippet': 'Fast just got faster with Nexus S. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'},
{'img': 'images/img.gif',
'name': 'Nexus S',
'snippet': 'The Next, Next Generation tablet. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'},
{'img': 'images/img.gif',
'name': 'Nexus S',
'snippet': 'The Next, Next Generation tablet. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'}
];
});


Many thanks in advance.


No comments:

Post a Comment