AngularJS Foundations

provider code

$provide.provider('age', {
    start: 10,
    $get: function() {
        return this.start + 2;
    }
});
$provide.provider('age', function($filterProvider) {
    this.start = 10;
    this.$get = function() {
        return this.start + 2;
    };
});
//调用:
app.controller('MainCtrl', function($scope, age) {
    $scope.age = age; //12 });