Putting a directive to the test, created in this way:
yo angular:directive countriesDirectives
After making some modifications, here is the resulting directive:
'use strict';
/**
* @ngdoc directive
* @name miaplicacionApp.directive:countriesDirective
* @description
* # countriesDirective
*/
angular.module('miaplicacionApp')
.directive('countriesDirective', function () {
return {
restrict: 'E',
template: '<h1>hjbjhbjhbjbjhbjhbjhbjhbjhbjhbjhbjhb</h1>',
link: function postLink(scope, element, attr) {
element.text('this is the countriesDirective directive');
}
};
});
Adding the directive to my index.html file:
<div class="container cont">
<h1>jkm</h1>
<countriesDirective></countriesDirective>
<br>
<br>
<br>
<br>
<ng-view></ng-view>
</div>
Running ''grunt serve'' after including the directive. Although everything seems to be working as expected, the directive itself does not seem to be functioning. It's important to note that Yeoman sets up all necessary files for the app to work, but there seems to be an issue with my directive specifically.