SHARE
TWEET

http problem

a guest Dec 25th, 2014 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //studenti.json
  2. [
  3.     {
  4.         "id": 1,
  5.         "ime": "Borko",
  6.         "prezime": "Dragojlovic",
  7.         "mesto": "Mladenovo"
  8.     },
  9.     {
  10.         "id": 2,
  11.         "ime": "Petar",
  12.         "prezime": "Petrovic",
  13.         "mesto": "Novi Sad"
  14.     },
  15.         {
  16.         "id": 3,
  17.         "ime": "Janko",
  18.         "prezime": "Dragojlovic",
  19.         "mesto": "Novi Sad"
  20.     },
  21.         {
  22.         "id": 4,
  23.         "ime": "Marko",
  24.         "prezime": "Markovic",
  25.         "mesto": "Mladenovo"
  26.     },
  27.         {
  28.         "id": 5,
  29.         "ime": "Milos",
  30.         "prezime": "Milosevic",
  31.         "mesto": "Mladenovo"
  32.     },
  33.         {
  34.         "id": 6,
  35.         "ime": "Ivan",
  36.         "prezime": "Ivanovic",
  37.         "mesto": "Mladenovo"
  38.     },
  39. ]
  40.  
  41. //index.html
  42.  
  43. <html>
  44.         <head>
  45.                 <title> Angular primer </title>
  46.                 <script src="angular.min.js"></script>
  47.                 <script src="invoice.js"></script>
  48.         </head>
  49.        
  50.         <body>
  51.                 <div ng-app="app1" ng-controller="appController">
  52.                        
  53.                           <li ng-repeat="student in studenti">
  54.                                 <p>{{student.id}}</p>
  55.                                 <p>{{student.ime}}</p>
  56.                                 <p>{{student.prezime}}</p>
  57.                                 <p>{{student.mesto}}</p>
  58.                           </li>
  59.                
  60.                 </div>
  61.         </body>
  62. </html>
  63.  
  64. //invoice.js
  65. var myApp = angular.module('app1',[]);
  66.  
  67. myApp.controller('appController', ['$scope', '$http',
  68.         function($scope, $http) {
  69.                 $scope.studenti = null;
  70.                 $http.get('studenti.json').success (function(data){
  71.                                 $scope.studenti = data;
  72.                 });
  73.         }]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top