prova2
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:
project.js
======
angular.module('project', ['mongolab']).
    config(function($routeProvider) {
    $routeProvider.
    when('/', {controller:ListCtrl, templateUrl:'list.html'}).
    when('/edit/:projectId', {controller:EditCtrl, templateUrl:'detail.html'}).
    when('/new', {controller:CreateCtrl, templateUrl:'detail.html'}).
    otherwise({redirectTo:'/'});
    });
     
     
    function ListCtrl($scope, Project) {
    $scope.projects = Project.query();
    }
     
     
    function CreateCtrl($scope, $location, Project) {
    $scope.save = function() {
    Project.save($scope.project, function(project) {
    $location.path('/edit/' + project._id.$oid);
    });
    }
    }
     
     
    function EditCtrl($scope, $location, $routeParams, Project) {
    var self = this;
     
    Project.get({id: $routeParams.projectId}, function(project) {
    self.original = project;
    $scope.project = new Project(self.original);
    });
     
    $scope.isClean = function() {
    return angular.equals(self.original, $scope.project);
    }
     
    $scope.destroy = function() {
    self.original.destroy(function() {
    $location.path('/list');
    });
    };
     
    $scope.save = function() {
    $scope.project.update(function() {
    $location.path('/');
    });
    };
    }

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。