Creating the Category Controller

Now, we need to create our controllers. We will start with the simplest to make the example more easy to understand. The CategoryController has the responsibility of controlling the data of the Category entity. There are two controllers, one enables us to create a category, and another lists all categories stored in the database.

The category-controller.js should be like this:

(function (angular) {  'use strict';  // Controllers  angular.module('cms.modules.category.controllers', []).  controller('CategoryCreateController',      ['$scope', 'CategoryService','$state',        function ($scope, CategoryService,$state) {          $scope.resetForm = function () {            $scope.category = null;          };          $scope.create = function (category) { CategoryService. ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.