Skip to content

Instantly share code, notes, and snippets.

@koningskristof
koningskristof / futureProofComponent
Created August 8, 2019 14:45
futureProofComponent
export class SomeComponent implements IComponentOptions {
bindings: any;
templateUrl: any = require('./some-component.html');
require: any;
controller: any = SomeComponentController;
}
export class SomeComponentController {
export class ExternalService {
public static $inject: Array<String> = [
'externalService'
];
constructor( private externalService) {
}
public getSomeState() {
return this.externalService.getSomeState();
export class InternalService {
public static $inject: Array<String> = [
'thisDomain.externalService'
];
constructor( private externalService) {
}
public doSomething() {
return this.externalService.getSomeState();
export class InternalService {
public static $inject: Array<String> = [
externalService'
];
constructor( private externalService) {
}
public doSomething() {
return this.externalService.getSomeState();
if(featureToggleService.isFeatureEnabled(‘FEATURE_NAME’)) {
doNewCode;
} else {
doOldCode;
}
if(featureToggleService.isFeatureEnabled('FEATURE_NAME')) {
doNewCode;
} else {
doOldCode;
}