angular2-template专题提供angular2-template的最新资讯内容,帮你更好的了解angular2-template。
我在打字稿中有这个组件定义: import {Component, ViewEncapsulation} from 'angular2/core'; @Component({ selector: 'my-app', templateUrl: '/views/sandbox.html', styleUrls: ['/styles/sandbox.css'], sty
我使用Angular2和Semantic UI作为css库.我有这段代码: <div class="ui three stakable cards"> <a class="ui card"> ... </a> <a class="ui card"> ... </a> <a class="ui card"> ... </a> </div> 卡片很好地呈现在它们之间的空间. 像这样:
使用setDate方法修改的日期对象未在模板中更新. 在模板中: <p>{{date | date:'mediumDate'}}</p> 在组件中: nextDay(){ this.date.setDate(this.date.getDate()+1); } 但是当我调用nextDay函数时,模板不会使用新值更新. 我可以让变更检测工作的唯一方法是这样做: nextDay(){
我在我的应用程序中使用角度2表单,我已根据给定的链接创建表单. https://angular.io/docs/ts/latest/guide/forms.html 在这个验证和使用表单API,我已设置ngModel值,如#name =“id”#id =“ngModel”,并抛出脚本错误.但如果我将#id =“ngModel”设置为#id =“ngForm”,它就会解决.但对于我的情况,我必须将我
对不起,如果这很简单,但只是想不出来…… 在我的Angular测试应用程序中,我试图将以下内容作为我的html模板的一部分附加: <a href="https://www.domainname.com/?q="+{{text.id}}>URL</a> 这不会失败并出现错误(错误:无法在’Element’上执行’setAttribute’)并且我不确定如何将{{text.id}}附加到此网址… 我是
我创建了一个组件,其中包含一个带有routerLink属性的元素,我想从使用该组件的模板中设置该属性.当我尝试这样做时,我收到错误消息’无法读取属性’未定义’的路径’. 我的组件看起来链接这个: INFO-box.component.ts import { Input, Component } from "@angular/core"; import { ROUTER_DIRECTIVES } f
我觉得我缺少一些东西,但是当我尝试在我的模板中使用数据属性,像这样: <ol class="viewer-nav"><li *ngFor="#section of sections" data-sectionvalue="{{ section.value }}">{{ section.text }}</li></ol> Angular2崩溃: EXCEPTION: Template pa
如果答案是被接受的答案,我试图显示一个复选标记: template: `<div ngIf="answer.accepted">✔</div>` 但我得到这个错误: EXCEPTION: No provider for TemplateRef! (NgIf ->TemplateRef) 我究竟做错了什么? 你错过了在NgIf前面的*(像我们都有,几十次): <div *ngIf="a
在这种情况下,我使用ngFor显示一个学生列表(数组)到视图中: <li *ngFor="#student of students">{{student.name}}</li> 它是美好的,它更新每当我添加其他学生到列表。 但是,当我给它一个管道过滤学生的名字, <li *ngFor="#student of students | sortByName:queryElem.value ">{{st
如果变量在组件类上声明为私有的,那么我应该能够在该组件的模板中访问它吗? @Component({ selector: 'my-app', template: ` <div> <h2>{{title}}</h2> <h2>Hello {{userName}}</h2> // I am getting this name </div> `, })
我如何复制一个对象,并失去它在角2的参考? 使用angular 1我使用angular.copy(对象),但我得到一些错误使用角2。 EXCEPTION:ReferenceError:angular未定义 假设你使用ES6,你可以使用var copy = Object.assign({},original)。在现代浏览器中工作;如果你需要支持旧的浏览器检查这个 polyfill 更新: 使用Typ
我无法找到一个良好的自动完成组件Angular2。只是任何东西,我可以传递一个键的列表,标签对象,并在输入字段有一个很好的自动完成。 Kendo不支持angular2,它是我们主要在内部使用。角材料似乎也不支持角2。 任何人都可以告诉我正确的方向或让我知道他们在使用什么? 这是我到目前为止。这是很糟糕,我想找到看起来不错的东西。 import {Component, EventEmitter, I
是否可以在同一个模板中设置多个路由器插座? 如果是,那么如何配置路由? 我正在使用angular2 beta。 谢谢。 是的,可以,但是您需要使用辅助路由。 你需要给你的路由器插座一个名字: <router-outlet name="auxPathName"></router-outlet> 并设置您的路由配置: @RouteConfig([ {path:'/', name: 'Retular
我从角度2得到这个错误 core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Error in app/model_exposure_currencies/model_exposure_currencies.component.html:57:18 caused by: If ngModel is used within a form
尝试使用嵌套组件时,我收到此异常: EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot set property 'endSourceSpan' of null XCEPTION: Error: Uncaught (in promise): TypeError: Cannot set property 'endSourceSpan'
在我的Angular 2应用程序中,当我向下滚动一个页面并点击页面底部的链接,它会改变路线,并带我到下一页,但不滚动到页面的顶部。结果,如果第一页是冗长的,第二页的内容很少,则给人的印象是第二页缺少内容。由于内容只有在用户滚动到页面顶部时才可见。 我可以将组件的ngInit中的窗口滚动到页面顶部,但是有没有更好的解决方案可以自动处理我的应用程序中的所有路线? 您可以在主要组件上注册一个路由更改侦听
我使用Angular2,并从官方网站下载了package.json。当我试图在@Component装饰器中使用“指令”时,我收到这个错误。 我附上我的代码错误: [ts] Argument of type '{ selector: string; template: string; directives: string; }' is not assignable to parameter of
我是新来的一般角度,特别是角度2。我试图写一个容器组件,它应该有子组件。 例如,容器组件: @Component({ selector: 'my-list', template: ` <ul> <ng-content></ng-content> </ul> ` }) export class MyList { } 子组件: import { Componen
我想将一个字符串值传递给angular2中的一个组件,但它不能与默认绑定一起使用。 我在想这样的事情: <component [inputField]="string"></component> 不幸的是,只有表达式允许在作业的右侧。有没有办法做到这一点? 您可以通过将字符串包含在引号中来传递字符串 <component [inputField]="'string'"></component>
我们可以在angular2视图模板中使用枚举吗? <div class="Dropdown" dropdownType="instrument"></div> 传递字符串作为输入: enum DropdownType { instrument, account, currency } @Component({ sel