This is the controller of the main template:
app.controller('OverviewCtrl', ['$scope', '$location', '$routeParams', 'websiteService', 'helperService', function($scope, $location, $routeParams, websiteService, helperService) { ... $scope.editWebsite = function(id) { $location.path('/websites/edit/' + id); }; }]);
This is the directive:
app.directive('wdaWebsitesOverview', function() { return { restrict: 'E', scope: { heading: '=', websites: '=', editWebsite: '&' }, templateUrl: 'views/websites-overview.html' } });
So the directive is applied in the main template:
<wda-websites-overview heading="'All websites'" websites="websites" edit-website="editWebsite(id)"></wda-websites-overview>
and this method is called from the directive template (website-overview.html):
<td data-ng-click="editWebsite(website.id)">EDIT</td>
QUESTION: When EDIT is clicked, this error appears in the console:
TypeError: cannot use the 'in' operator to search for 'editWebsite' in 1
Does anyone know what is going on here?
javascript angularjs angularjs-scope angularjs-directive
CodeVirtuoso May 14 '15 at 18:09 2015-05-14 18:09
source share