I'm struggling to get my Angular directives working in my project. I've tried implementing a basic one, but for some reason it's not showing anything on the screen. Can anyone help me troubleshoot this issue?
Here is my JS code:
angular
.module('app.admin.catalog.nutritional_facts')
.directive('nutritionalInfo', nutritionalInfo);
function nutritionalInfo(){
return{
restrict: 'E',
scope: {
quantity: '=',
unit: '='
},
template: "<div> Hello world {{ '{{quantity.qty}} {{unit.u}}' }}</div>"
};
}
This is how I'm using it in my HTML file:
<nutritional-info quantity="{qty:4}" unit="{u:'g'}"></nutritional-info>
Despite trying various data types as attributes, all I see is an empty label instead of "Hello world". As a beginner in Angular, this problem has got me stumped. Any suggestions would be greatly appreciated.