【发布时间】:2016-03-29 01:49:55
【问题描述】:
我在 ng2 中集成一个计量设计 (http://www.getmdl.io/) 时遇到了一个小问题 你能帮我么 我会用我所做的来说明这一点
- http://www.getmdl.io/started/index.html#tab1,解释设计的集成
- http://www.getmdl.io/components/index.html#textfields-section,这是一个带有浮动标签的文本字段示例 现在我有Plunkr,我集成了它,但没有工作 你能看看吗 正如您在 index.html 中看到的,我包含 http://www.getmdl.io/started/index.html#tab1 建议的 css 和 js 文件
<!-- GetMDL scripts -->
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- GetMDL scripts -->
在 app.component.ts 文件中:
import {Component, ViewEncapsulation} from 'angular2/core';
@Component({
selector: 'my-app',
template: `<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3">
<label class="mdl-textfield__label" for="sample3">Text...</label>
</div>
</form>`,
encapsulation:ViewEncapsulation.None,
})
【问题讨论】:
-
这里的答案非常有用,但我发现在处理路由器正在渲染的组件时它们还不够。如果您遇到与路由器相关的问题,您可能会对this question(和答案)感兴趣。
标签: typescript integration angular