Skip to content

Instantly share code, notes, and snippets.

@Madhust
Created June 6, 2022 15:56
Show Gist options
  • Save Madhust/0352c4b885cf344b347260618e6e4952 to your computer and use it in GitHub Desktop.
Save Madhust/0352c4b885cf344b347260618e6e4952 to your computer and use it in GitHub Desktop.
stateless-standalone-component
import { StatelessComponent } from '@protools/angular';
@Component({
selector: 'app-view',
standalone: true,
imports: [CommonModule],
templateUrl: './view.component.html',
styleUrls: ['./view.component.scss']
})
@StatelessComponent()
export class ViewComponent {
@Input()
title = 'stateless-stand-alone-experiment';
@Output()
titleChanged = new EventEmitter()
increment() {
// StatelessComponent decorator will not allow title mutation and throws runtime error.
this.title = "Title Changed";
this.titleChanged.emit('Title Changed');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment