Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/angularAMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ define(function () {
$provide: provide
};

// Substitue provider methods from app call the cached provider
// Substitute provider methods from app call the cached provider
angular.extend(onDemandLoader, {
provider : function(name, constructor) {
provide.provider(name, constructor);
Expand All @@ -408,6 +408,9 @@ define(function () {
compileProvider.directive(name, constructor);
return this;
},
component : function(name, constructor) {
// do nothing by default
},
filter : function(name, constructor) {
filterProvider.register(name, constructor);
return this;
Expand All @@ -431,6 +434,17 @@ define(function () {
},
animation: angular.bind(animateProvider, animateProvider.register)
});

// Only add component method if present on compileProvider (i.e. Angular >= v.1.5):
if (compileProvider.component) {
angular.extend(onDemandLoader, {
component : function(name, constructor) {
compileProvider.component(name, constructor);
return this;
}
});
}

angular.extend(alt_app, onDemandLoader);

}]
Expand Down Expand Up @@ -498,6 +512,8 @@ define(function () {
AngularAMD.prototype.controller = executeProvider('controller');
// .directive
AngularAMD.prototype.directive = executeProvider('directive');
// .component
AngularAMD.prototype.component = executeProvider('component');
// .filter
AngularAMD.prototype.filter = executeProvider('filter');
// .factory
Expand Down