文档: https://angular.io/guide/template-syntax#event-binding

The Angular compiler may reject these bindings with errors like this one:

content_copyUncaught Error: Template parse errors:
Can't bind to 'hero' since it isn't a known property of 'app-hero-detail'

You know that HeroDetailComponent has hero and deleteRequest properties. But the Angular compiler refuses to recognize them.

The Angular compiler won't bind to properties of a different component unless they are Input or Output properties.

There's a good reason for this rule.

It's OK for a component to bind to its own properties. The component author is in complete control of those bindings.

But other components shouldn't have that kind of unrestricted access. You'd have a hard time supporting your component if anyone could bind to any of its properties. Outside components should only be able to bind to the component's public binding API.

Angular asks you to be explicit about that API. It's up to you to decide which properties are available for binding by external components.

TypeScript public doesn't matterlink

You can't use the TypeScript public and private access modifiers to shape the component's public binding API.

All data bound properties must be TypeScript public properties. Angular never binds to a TypeScript privateproperty.

Angular requires some other way to identify properties that outside components are allowed to bind to. That other way is the @Input() and @Output() decorators.

angular6 Can't bind to 'zzst' since it isn't a known property of的更多相关文章

  1. Angular4 - Can't bind to 'ngModel' since it isn't a known property of 'input'.

    用[(ngModel)]="xxx"双向绑定,如:控制台报错:Can't bind to 'ngModel' since it isn't a known property of ...

  2. Angular 报错 Can't bind to 'formGroup' since it isn't a known property of 'form'

    错误描述 当form表单加FormGroup属性时报错 Can't bind to 'formGroup' since it isn't a known property of 'form' < ...

  3. Angular: Can't bind to 'ngModel' since it isn't a known property of 'input'问题解决

    https://blog.csdn.net/h363659487/article/details/78619225 最初使用 [(ngModel)] 做双向绑定时,如果遇见Angular: Can't ...

  4. Angular - Can't bind to 'ngModel' since it isn't a known property of 'input'.

    用[(ngModel)]="xxx"双向绑定,如:控制台报错:Can't bind to 'ngModel' since it isn't a known property of ...

  5. Can't bind to 'ngModel' since it isn't a known property of 'input'.

    angular项目启动报错 Can't bind to 'ngModel' since it isn't a known property of 'input'. 原因:当前module模块未引入 ' ...

  6. 在懒加载的Ionic工程中使用 ionic2-auto-complete 组件:Can't bind to 'dataProvider' since it isn't a known property of 'ion-auto-complete'

    问题描述: 在基于懒加载的Ionic工程中,使用ionic2-auto-complete组件(GitHub地址:https://github.com/kadoshms/ionic2-autocompl ...

  7. Can't bind to 'formGroup' since it isn't a known property of 'form'

    在APP.module.ts中引入FormsModule, ReactiveFormsModule. import { BrowserModule } from '@angular/platform- ...

  8. ANGULAR6.x - 错误随笔 - Can't bind to 'formGroup'

    formGroup:错误 Can't bind to 'formGroup' since it isn't a known property of 'form'. (" 原因: 在使用for ...

  9. How to bind to data when the DataContext is not inherited【项目】

    http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherit ...

随机推荐

  1. JSOI2018R2题解

    D1T1:潜入行动 裸的树上DP.f[i][j][0/1][0/1]表示以i为根的子树放j个设备,根有没有放,根有没有被子树监听,的方案数.转移显然. #include<cstdio> # ...

  2. 【原创】自己动手写的一个查看函数API地址的小工具

    C开源代码如下: #include <stdio.h> #include <windows.h> #include <winbase.h> typedef void ...

  3. 2018-2019-2 20162318《网络对抗技术》Exp3 免杀原理与实践

    一.实验内容 1.正确使用msf编码器,msfvenom生成如jar之类的其他文件,veil-evasion),加壳工具),使用shellcode编程 2.通过组合应用各种技术实现恶意代码免杀(如果成 ...

  4. Wannafly挑战赛22游记

    Wannafly挑战赛22游记 幸运的人都是相似的,不幸的人各有各的不幸. --题记 A-计数器 题目大意: 有一个计数器,计数器的初始值为\(0\),每次操作你可以把计数器的值加上\(a_1,a_2 ...

  5. 高并发系列之——负载均衡,web负载均衡

    1 前言 负载均衡,一般包含两方面的含义.一方面是,将单一的重负载分担到多个网络节点上做并行处理,每个节点处理结束后将结果汇总返回给用户,这样可以大幅提高网络系统的处理能力: 第二个方面的含义是,将大 ...

  6. SLF4J versions 1.4.0 and later requires log4j 1.2.12 or later 终极解决

    http://blog.sina.com.cn/s/blog_54eb26870100uynj.html 到SLF4J官方网站:http://www.slf4j.org/codes.html#log4 ...

  7. bzoj 4237: 稻草人 -- CDQ分治

    4237: 稻草人 Time Limit: 40 Sec  Memory Limit: 256 MB Description JOI村有一片荒地,上面竖着N个稻草人,村民们每年多次在稻草人们的周围举行 ...

  8. nlogn 求最长上升子序列 LIS

    最近在做单调队列,发现了最长上升子序列O(nlogn)的求法也有利用单调队列的思想. 最长递增子序列问题:在一列数中寻找一些数,这些数满足:任意两个数a[i]和a[j],若i<j,必有a[i]& ...

  9. [Visual Studio] 重置默认设置 还原默认设置

    恢复默认设置的2种方法 如果VS出现问题或设置变乱,可以通过恢复默认设置使之回到安装成功时的状态,从而解决出现的问题.VS恢复默认设置的方法有2种,分别是:通过“导入和导出设置”实现和通过命令实现. ...

  10. Thinkpad T440p安装Linux的种种问题(by quqi99)

    作者:张华  发表于:2014-05-08 版权声明:能够随意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (http://blog.csdn.net/quqi99 ) Thi ...