Angular - nie wypisuje konkretnej danej

0

Uczę się Angular 1 nie wiem czemu, nie wypisuje mi konkretnej zmiennej, konkretnie tego:

{{store.products.name}}

KOD HTML:

<!DOCTYPE html>
<html lang="en" ng-app="store">
<head>
    <meta charset="UTF-8">
    <title>ANGULAR TEST!!!</title>
 
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
 
    <!--<script rel="script" src="js/jQuery-2.1.1.min.js" ></script>-->
    <!--<script rel="script" src="js/bootstrap.min.js"></script>-->
    <script rel="script" src="js/angular-1.5.5.min.js"></script>
    <script rel="script" src="js/scripts.js"></script>
</head>
<body>
<div ng-controller="StoreController as store">
    <h1>{{store}}</h1>
    <hr/>
    {{store.products.name}}
</div>
</body>
</html>

KOD JS:


(function() {
  var app, gems;
 
  app = angular.module('store', []);
 
  app.controller('StoreController', function() {
    return this.products = gems;
  });
 
  gems = {
    name: 'Chleb',
    price: 2.5,
    description: 'Chleb mazowiecki z pierwszego asdas'
  };
 
}).call(this);

Po uruchomieniu strony przeglądarka wypluwa:
user image

0

Po małej zmianie działa https://jsfiddle.net/fhbjb4eL/

0

:)

1 użytkowników online, w tym zalogowanych: 0, gości: 1