The goal is to generate 2 different apps from the same codebase, one for the user and another for the admin. They are very similar, and I just want to disable some blocks. The way I'm tackling this right now via *ngIf and an environment variable
User stuff
<div *ngIf="environment.adminVersion">
Admin stuff
<div (click)="adminFunction()"></div>
</div>
The whole point is that I want to make the user version lighter, and all the admin stuff is not required for the user in order to use the app. My question is, are those blocks being removed from the transpiled verson at all?
Is there also a way to achieve this en the logic?
class welcomePage() {
userFunction() {
}
adminFunction() {
if (environment.adminVersion) {
Do admin stuff...
}
}
}
Is there a C-preprocessor control equivalent in angular/typescript? What would be the best approach? I guess what I guess I'm looking for is something like this, which gets removed or added before it even compiles:
#define version admin
User stuff
#if version==admin
Admin stuff
<div (click)="adminFunction()"></div>
#endif
#if version==admin
class welcomePage() {
userFunction() {
}
#if version==admin
adminFunction() {
if (environment.adminVersion) {
Do admin stuff...
}
}
#endif
}