0

I'm new in Node JS and Angular. Making a small test project that retrieves rules data from a restful api, the api works fine... I load all rules in rules.html but each one of them has a link to view the details which is my pain right now... according to the tutorial the link should point to /rules/details/{{rule._id}}

app.js

var app = angular.module('SmartSoftApp', ['ngRoute']);

app.config(['$routeProvider', function($routeProvider){   
    $routeProvider.when('/rules/details/:id', {
        moduleId: app.id, 
        templateUrl: '/views/ruleDetails.html',
        controller: 'RulesController'
    })
})

The issue here is, when I click the link, I get Cannot GET /rules/details/[id]. I can change the link to point the html file instead but I assume that's not how it works.

I'm new at this so I appreciate if someone can guide me through this

Thanks

Community
  • 1
  • 1

1 Answers1

0

The link should be "#/rules/details/{{rule._id}}"

<a href="#/rules/details/{{rule._id}}">Link</a>

Also as you are binding values from your model you should use ng-href.

https://docs.angularjs.org/api/ng/directive/ngHref

marcosspn
  • 376
  • 5
  • 14