angular2-styleguide

Input and outputs, how to work with them to follow the naming convention of the Angular 2's styleguide?

折月煮酒 提交于 2020-07-20 07:28:08
问题 Before I knew any better I used to have my directive defined like this: ... inputs: [ 'onOutside' ] ... export class ClickOutsideDirective { @Output() onOutside: EventEmitter<any> = new EventEmitter(); } But then I read the styleguide and it said that you should not prefix your outputs with on since Angular 2 supports the on- syntax in the templates. So I'm trying to change it to something like: @Input() outsideClick: any; @Output() outsideClick: EventEmitter<any> = new EventEmitter();

Input and outputs, how to work with them to follow the naming convention of the Angular 2's styleguide?

无人久伴 提交于 2020-07-20 07:28:01
问题 Before I knew any better I used to have my directive defined like this: ... inputs: [ 'onOutside' ] ... export class ClickOutsideDirective { @Output() onOutside: EventEmitter<any> = new EventEmitter(); } But then I read the styleguide and it said that you should not prefix your outputs with on since Angular 2 supports the on- syntax in the templates. So I'm trying to change it to something like: @Input() outsideClick: any; @Output() outsideClick: EventEmitter<any> = new EventEmitter();

Angular 2 - How do I conditionally add styles to my component?

强颜欢笑 提交于 2019-12-01 21:52:43
问题 I have a component with a stylesheet that loads correctly like this: @Component({ selector: 'open-account', styleUrls: ['open-account.component.scss'], templateUrl: './open-account.component.html', }) I want to conditionally load another stylesheet if the string widget=true is present in the url but cannot get anyway to work. I have tried: var stylesArr = ['open-account.component.scss']; if (window.location.href.indexOf('widget=true') > -1) stylesArr.push('open-account-widget-styles.component

Angular 2 - How do I conditionally add styles to my component?

a 夏天 提交于 2019-12-01 21:16:19
I have a component with a stylesheet that loads correctly like this: @Component({ selector: 'open-account', styleUrls: ['open-account.component.scss'], templateUrl: './open-account.component.html', }) I want to conditionally load another stylesheet if the string widget=true is present in the url but cannot get anyway to work. I have tried: var stylesArr = ['open-account.component.scss']; if (window.location.href.indexOf('widget=true') > -1) stylesArr.push('open-account-widget-styles.component.scss'); @Component({ selector: 'open-account', styleUrls: stylesArr, templateUrl: './open-account