我有一个HTML INPUT字段.
<input
[(ngModel)]="item.value"
name="inputField"
type="text"
/>
Run Code Online (Sandbox Code Playgroud)
我想格式化它的值并使用现有的管道:
....
[(ngModel)]="item.value | useMyPipeToFormatThatValue"
....
Run Code Online (Sandbox Code Playgroud)
并收到错误消息:
动作表达式中不能有管道
在这种情况下如何使用管道?
编辑:更新了Plunkr:http://plnkr.co/edit/fQ7P9KPjMxb5NAhccYIq?p = preview
这部分有效:
<div *ngFor="let entry of entries | async">
Label: {{ entry.label }}<br>
Value: {{ entry.value }}
</div>
Run Code Online (Sandbox Code Playgroud)
但我对选择框有问题,错误信息是:
无法绑定到'ngModel',因为它不是'select'的已知属性
整个组件:
//our root app component
import {Component} from '@angular/core';
import {NgFor} from '@angular/common';
import {HTTP_PROVIDERS, Http} from '@angular/http';
import 'rxjs/Rx';
import {Observable} from 'rxjs/Rx';
@Component({
selector: 'my-app',
providers: [HTTP_PROVIDERS],
template: `
<select [(ngModel)]="selectValue" name="selectValue">
<option *ngFor="let entry of entries | async"
[value]="entry.value">{{entry.label}}</option>
</select>
<div *ngFor="let entry of entries | async">
Label: {{ entry.label }}<br>
Value: {{ …Run Code Online (Sandbox Code Playgroud) json asynchronous drop-down-menu angular2-observables angular
如何禁用yii-debug-toolbar特定视图,尤其是部分渲染视图?
这可能吗?
Yii-debug-toolbar遗憾的是,ps 不会作为下面的标记存在.
在最新版本的Bootstrap(当前版本提出问题时bootstrap@4.0.0-alpha.5)有3个不同的文件和标准的文件:
前3个文件是bootstrap.css(#4)的扩展名吗?
我可以想象,bootstrap-flex使用CSS Flexbox的功能bootstrap-grid可能是旧的和已经存在的方式,但是呢bootstrap-reboot?
我必须包含哪一个(特别是如果我在Angular 2中使用ng-bootstrap)?
我在Angular2中有一个表单(例如)
<form id="myLovelyForm" name="myLovelyForm" #myLovelyForm="ngForm">
<label [attr.for]="myLovelyCheckbox">
<input [attr.id]="myLovelyCheckbox" type="checkbox"
[(ngModel)]="myLovelyCheckbox">
<span class="myLovelyCheckbox">myLovelyCheckbox</span>
</label>
</form>
Run Code Online (Sandbox Code Playgroud)
如果表单是脏的,应该启动一个动画:
<div
id="myLovelyNotification"
class="myLovelyNotification"
[@notification]="myLovelyForm.form.dirty">
.....
.....
</div>
Run Code Online (Sandbox Code Playgroud)
如果我设置[@notification] = true,动画可以正常工作,但是myLovelyForm.dirty如果我触摸表单并更改元素,我就不会触发.
如果@notification为false,则动画停止,即如果之前选中了复选框并且我错误地取消选中并再次选择它,则表单不再是原始(触摸)但不再脏,因此动画应该停止.如果我手动设置@notification = false,它可以正常工作.
最大的问题是:如何以正确的方式检测/观察角度2形式的"脏状态"?
Yarn是否有可能使用npm的配置?所有必要的设置都存在于.npmrc文件中,纱线也应该使用它们.
公司代理背后的标准错误之一:Yarn无法验证第一个证书.
以下建议 - 在类似问题中给出答案 - :
yarn config set "strict-ssl" false -g
Run Code Online (Sandbox Code Playgroud)
不起作用,因为SSL不是唯一的原因.代理设置(等)也必须继承.
我偶然发现了一个名为yarnrc的npm-package,这使我们可以在不同的yarn设置之间进行切换,但是我找不到任何解决方案,所以Yarn从npmrc继承了相同的配置.
HMR(热模块更换)是一项出色的功能,如果不存在“路由解析”(请参阅下文),该功能将正常运行。
如果我resolve在这里删除:
{
path: 'new',
component: BookNewComponent,
data: {
breadcrumb: 'book.new.breadcrumb'
},
resolve: {
staticData: StaticDataResolve
}
},
Run Code Online (Sandbox Code Playgroud)
HMR重新工作。如果resolve存在-> HMR将重新加载整个应用程序,而不是特定组件。
我怎么解决这个问题?
有可能,如果是的话怎么样?我想实现类似的东西(例如在compilerOptionsin中tsconfig.json):
// ATTENTION PSEUDO CODE
suppressErrors: ['TS7017', ....]
Run Code Online (Sandbox Code Playgroud)
ps TS7017:对象类型的索引签名隐式具有"任何"类型.
很明显,该方法是如何工作的:
f = ['a','b','c','d','e','f','g','h'];
console.log(f.copyWithin(4,2,5));
// copy elements between 2 (start) & 5 (end) -> to target -> 4
// [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' ] <-- original array
// ^ ^ ^
// | | | <-- [2,5[ = c,d,e
// 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7
// |
// 'c', 'd', 'e', <-- copy to 4
// [ 'a', 'b', 'c', 'd', | | | …Run Code Online (Sandbox Code Playgroud) 我如何获取可用的馆藏/软件包/图书馆的列表
ng add <collection>
还有可能搜索现有软件包吗?
angular ×6
add ×1
arrays ×1
asynchronous ×1
bootstrap-4 ×1
collections ×1
copy ×1
css ×1
debugging ×1
forms ×1
html-input ×1
in-place ×1
javascript ×1
json ×1
methods ×1
ng-bootstrap ×1
npm ×1
package ×1
php ×1
pipe ×1
proxy ×1
resolve ×1
routes ×1
tsconfig ×1
typescript ×1
webpack-hmr ×1
yarnpkg ×1
yii ×1