ng-content 在选择标签 Angular2 中不起作用 [英] ng-content is not working inside select tag Angular2

查看:38
本文介绍了ng-content 在选择标签 Angular2 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个自定义下拉组件,但是当我尝试通过 ng-content 在 select 标签中访问数据时,它不起作用.

i am trying to make a custom dropdown component but when i try to access data through ng-content inside select tag its not working.

这是我的自定义组件 html 文件:

this is my custom-component html file:

<select class="form-control">

    <ng-content></ng-content>

</select>

这是我调用组件的主要 html 文件:

this is my main html file where i am calling the component:

<dropdown>
        <option value="">Select details type</option>
        <option value="">Personal</option>
        <option value="">General</option>
        <option value="">Contact</option>
        <option value="">Settings</option>
 </dropdown>

我做错了什么???

推荐答案

目前 angular2 使用原生(浏览器)HTML 解析器.根据标准只有 HTML 元素允许在

发送“验证码”获取 | 15天全站免登陆