February 2018
Intermediate to advanced
356 pages
9h 10m
English
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. ...