Apologies if my explanation is unclear, but I am struggling to find a simple way to convey the following information.
I have set up a navigation bar that displays different categories of articles. These navigation items are pulled from a database and can be edited in the back-office.
To retrieve the categories, I am using an AngularJS controller :
app.controller('ApiController', ['$scope', '$http', function($scope, $http) {
$http.get('/categories')
.success(function(categories) {
$scope.categories = categories;
});
}]);
<div class="collapse navbar-collapse" id="target-navbar-main">
<ul class="nav navbar-nav>
<li ng-repeat="category in categories">
<a href="/<% category.slug %>" title="<% category.name %>"><% category.name %></a>
</li>
</ul>
</div>
In the body of the page, I am utilizing another controller to fetch articles based on the selected category. However, I am facing challenges in establishing communication between the navbar and the articles controller to pass along the category information when a button is clicked.
Your assistance in this matter would be greatly appreciated.