tenthfloor
tenthfloor

Reputation: 160

What is AngularPublic.js?

If I wanted to add my own custom "provider" to the list (in AngularPublic.js), like so:

... 

$provide.provider({
    $anchorScroll: $AnchorScrollProvider,
    $animate: $AnimateProvider,
    $browser: $BrowserProvider,
    $cacheFactory: $CacheFactoryProvider,
    $controller: $ControllerProvider,
    $myCustomController: $MyCustomControllerProvider, <---- I made this
    $document: $DocumentProvider,
    $exceptionHandler: $ExceptionHandlerProvider,
    $filter: $FilterProvider,
    $interpolate: $InterpolateProvider,

...etc

If I used an existing provider as boilerplate, would this be a bad idea?

Upvotes: 0

Views: 79

Answers (1)

ssnau
ssnau

Reputation: 367

Yes, it is definitely a bad idea. I don't think it is reasonable to modify the source code of Angular as Angular itself is fast growing, things change every second, you may find it is hard to merge your change with newest Angular version one day.

If you only want to add your custom provider into ngModule, you can just to this.

var ngModule = angular.module('ng');

ngModule.provider('myCustom', function() {
     // Your code goes here
});

Hope it may help you.

Upvotes: 1

Related Questions