[英]Can i include angular 1 component without custom tag or selector
Hi I have angular 1 component:嗨,我有 angular 1 个组件:
angular.module('main').directive('globalNotification', (_, moment, $modal, Auth, Payments, adds) => ({
restrict: 'E',
replace: true,
templateUrl: '/client/directive/global-global-notification/global-notification.html',
And previously it was rendered in index as <global-notification></global-notification>
But now i have angular 1 and vue js working together and Vue complaining about that custom component because it is not related to vue.以前它在索引中呈现为
<global-notification></global-notification>
但现在我有 angular 1 和 vue js 一起工作,Vue 抱怨那个自定义组件,因为它与 vue 无关。
So, question can i somehow render component like this <div global-notification></div>
to remove error from console.所以,问题我可以以某种方式呈现像这样的组件
<div global-notification></div>
以从控制台中删除错误。 Is there are any pitfalls in this approach?这种方法有什么陷阱吗?
I believe, that in your case, you can just change restriction from E
to A
.我相信,在您的情况下,您可以将限制从
E
更改为A
。
restrict: 'A',
<div global-notification></div>
As documentation ( https://docs.angularjs.org/guide/directive ) says:作为文档( https://docs.angularjs.org/guide/directive )说:
'A' - only matches attribute name
'E' - only matches element name
'C' - only matches class name
'M' - only matches comment
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.