-
Notifications
You must be signed in to change notification settings - Fork 22
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
viewContainerRef实例获得的方法? #5
Comments
ViewContainerRef 是来自 Angular 组件或指令的,普通的 HTML 元素如果没有被 Angular 强化过,那么自然就不会有这类实例了。 |
@asnowwolf 如果是想获得父组件的实例,不通过通信的方式能一方面获取到吗 |
依赖注入并 SkipSelf 就是标准方式了。这能满足你的需求不? |
@asnowwolf ..那还是需要通信...通过另一种方式解决了(父组件不是我写的,所以才问非通信方式.),不得不说模拟shadow dom的方式真强大,把元素移动到组件外面,css样式都能生效,之前以为没什么优点呢 |
建议不要关闭问题,以便别人搜索它。我可以标上已解决。 要想用注入的方式通信并不要求父组件也是你写的,任何库中的父组件都可以注入进来,只要有它的类引用即可。 模拟 Shadow DOM 的方式是可以生效,但是离原生 Shadow DOM 的行为太远了,并不是很好的解决方案。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
目前我知道的有两种,
那么有没有可以将普通的html元素转化成ViewContainerRef实例的方法?
看了相关的api,属性和方法都没有找到相关解决方法.只有实例->元素,没有元素->实例,所以来问下有这样的手段可以转化吗?
The text was updated successfully, but these errors were encountered: