Using same controller for all CRUD operations (Rails-alike)
问题 I have an angular controller that fetches a resource on creation: angular.module('adminApp') .controller('PropertiesCtrl', function ($log, $scope, Property, $location) { $scope.properties = Property.query() }); Now I want to add logic to the controller to be able to create a "Property" resource: angular.module('adminApp') .controller('PropertiesCtrl', function ($log, $scope, Property, $location) { $scope.properties = Property.query() $scope.create = function(){ //logic to create }; });