Issue with template in sharedVar in angular

I want to know if I need to implement this in template tag only

 template: ` <p>Child: {{sharedVar}}</p> 
 <input [(ngModel)]="sharedVar" 

...because in my component I have

  selector: 'app-transaction',
  templateUrl: './transaction.component.html',
  styleUrls: ['./transaction.component.scss', ],


like this. Can I implement it in my html directly

I referred it from -

Angular 2 ngModel in child component updates parent component property

1 answer

  • answered 2018-05-16 06:01 Sanoj_V

    No, you can not use both property in one component use either templateUrl or template Beacuse template is inline editing and templateUrl is html page inside editing. So you have to choose one only.