Struggling to grasp the concept of directives and encountering a bug along the way.
To see my example in action, check out the codepen I've created here
In my scope called "movies," I have 3 movie titles that I want to display using a directive.
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.movies = [
{
title: 'Star Wars',
release_date: '10-11-2015'
}, {
title: 'Spectre',
release_date: '25-12-2015'
}, {
title: 'Revenant',
release_date: '02-03-2016'
}
];
});
Additionally, I've implemented a directive as follows:
app.directive('movieOverview', function () {
return {
template: 'Name: {{movie.title}}',
controller: 'MainCtrl'
};
});
Here is the haml code snippet:
%html{"ng-app" => "plunker"}
%body{"ng-controller" => "MainCtrl"}
%movie-Overview
Although the directive does display "Name:" on the page, it's not showing the results from the scope as intended.