vendredi 24 juin 2016

Can't show single item on click Angular

I'm getting the following error when I want to click on a link to show a single template (item):

WARNING: Tried to load angular more than once.

Link to screenshot: http://i.imgur.com/ZZDEA3J.png

Here is my templates.html code:

<div ng-repeat="template in filteredTemplates | filter:q" class="col-lg-4 col-md-6 col-sm-6 col-xs-12 portfolio-item">
  <h4>
      <a href="/edit/{{template.id}}" class="template-name"  >{{ template.name }} </a>
  </h4>
  <p>{{ template.content.substring(0, 40) | htmlToPlaintext | removeNbsp }} ...</p> 
  <div class="row">
      <div class="col-lg-6">
          <div ng-repeat="license in template.licenses">{{license.name}} prijs <i class="fa fa-eur" aria-hidden="true"></i> {{license | setPrice}}</div>
      </div>                                        
      <div class="col-lg-6">
          <a ng-click="placeOrder(template)"  class="btn btn-info" role="button"> Add to cart <span class="fa fa-cart-plus"></span></a>
      </div>
  </div>
</div>

app.js code:

//This will handle all of our routing
app.config(function($routeProvider, $locationProvider){
    $routeProvider.when('/', {
        templateUrl: 'js/templates/home.html',
        controller: 'HomeController'
    });

    $routeProvider.when('/templates', {
        templateUrl: 'js/store/templates.html',
        controller: 'TemplateController'
    });

    $routeProvider.when('/edit/:id', {
        templateUrl: 'js/store/template.html',
        controller: 'GetTemplateController'
    });

    $locationProvider.html5Mode({
        enabled: true,
        requireBase: false
    });
});

templateController.js:

template.controller('GetTemplateController', function ($scope, $routeParams, Template) {
      console.log('here');
});

I suspect that the problem comes from the app.js file. Does someone knows what I'm doing wrong? Because I really can't figure it out

Aucun commentaire:

Enregistrer un commentaire