0

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?

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

4 Comments

and if the addon pablo is not present, it wont show anything nor throw any error?
If the html is not located it would throw a regular file not found exception.
But if there is a lot of available plugins, and the customer only install one, it will throw a lot of file not found exception
He references your code only once, thats the only point HE has to make sure exists. The rest of the errors from your own code, you can make sure doesn't throw any unnecessary errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.