Pablo
Pablo

Reputation: 10650

How to create modules/addons on AngularJS

I'm building a web-app that will be used by several people. All have the same basic app, but each one needs some extra features, which the others do not need.

I'm trying to create some how some modules or addons to the app, so each one can install them if need.

The basic behavior of each addon, would be add a div into the main page.

A link inside that div will redirect to an html inside the folder of the addon, so, there is no problem with that part, I just need to add the div to the main page.

Which should be the correct way for doing this?

Upvotes: 0

Views: 28

Answers (1)

AlexD
AlexD

Reputation: 4310

You should have your HTML + Controller + CSS built-in separately, then all your 'consumers' have to do is include your javascript/css files, and use your template.

You can inject any template in AngularJS using ngInclude

<div ng-include="'addons/pablo.html'"></div>

Upvotes: 1

Related Questions