我试图limitTo在字符串上运行Angular2上的管道:
{{ item.description | limitTo : 20 }}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
The pipe 'limitTo' could not be found
Run Code Online (Sandbox Code Playgroud)
这是我的 app.module
从'./limit-to.pipe'导入{TruncatePipe};
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
InMemoryWebApiModule.forRoot(InMemoryDataService),
RouterModule.forRoot([
{
path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{
path: 'home',
component: GridComponent
},
])
],
declarations: [
AppComponent,
TopNavComponent,
GridComponent,
TruncatePipe
],
providers: [
PinService,
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
我使用管道的网格组件:
import { Component,OnInit } from '@angular/core';
import { Router } from '@angular/router'; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Angular2动画系统,用于伪元素:before.根据动画流程,我需要定义动画状态:
animations: [
trigger('heroState', [
state('inactive', style({
backgroundColor: '#eee',
transform: 'scale(1)'
})),
state('active', style({
backgroundColor: '#cfd8dc',
transform: 'scale(1.1)'
})),
transition('inactive => active', animate('100ms ease-in')),
transition('active => inactive', animate('100ms ease-out'))
])]
Run Code Online (Sandbox Code Playgroud)
然后将其附加到DOM元素,如下所示:
<ul>
<li *ngFor="let hero of heroes"
[@heroState]="hero.state"
(click)="hero.toggleState()">
{{hero.name}}
</li>
Run Code Online (Sandbox Code Playgroud)
但是,我想将其附加到伪before元素.我怎样才能做到这一点?
我试图从我的项目中删除未使用的函数.由于它有数千条线,这需要永远.
代码覆盖工具可能会建议在给定测试用例中未使用的函数,但仅依赖于此可能是危险的.
还有其他工具可以帮助解决这个问题吗?
我有以下配置对象,它在构造函数运行之前设置:
config: Object = {
onSlideChangeEnd : function(slide:any) {
this.currentSlideIndex = slide.activeIndex;
}
};
Run Code Online (Sandbox Code Playgroud)
我想通知服务有关更改,问题是在设置配置时服务还不可用:
constructor(private user: UserService,
private layout: LayoutService) {
}
Run Code Online (Sandbox Code Playgroud)
如何通过此变量更改通知服务?
我正在尝试播放嵌入 iOS 本机应用程序中的内嵌视频。
无论我做什么,播放视频后播放器都会自动进入全屏。
我正在尝试所有提到的建议,例如playsinline,allowfullscreen="false"等等controls="false"。
有没有办法阻止iOS webview进入全屏?
我已经将我的iOS升级到8.4,然后我尝试运行Xcode 6.3,它要求它无法安装设备,因为它运行的是8.4版本("...运行这个版本的Xcode不支持的iOS版本."当我尝试将Xcode升级到6.4时 - 每次更新失败并显示错误消息(再次尝试使用购买).
有什么建议如何解决这个问题?
我尝试使用NodeJS(Express)作为服务器创建angular2应用程序.问题是Express存在冲突,因为Express尝试使用自己的模板引擎并路由请求,而angular也使用routes和index.html作为入口点.
我怎样才能整合两者?
我需要找到一种方法将点击事件从顶部的div传递到它下方的div(并忽略更高div上的点击). 有一种模拟click事件并将其传递给另一个div的已知方法,但这不是一种自然行为,也是最不需要的选项.
事件冒泡似乎没有帮助,因为顶部的div不包含在下面的那个..
任何的想法?
这是一个jsfiddle示例:
如果删除"overlay"div,则可以单击其中一个元素.虽然它在那里,但你不能.可以将事件传递给下面的div,但是,位置很重要 - 可以有一个我希望用户能够点击的链接.
我正在遵循 angular 的最佳实践来制作 PWA。在进行生产构建 ( ng build --prod --aot) 之后,我还从 dist, on 运行服务工作线程localhost:
http-server -p 8080 -c-1 dist
当我尝试将工作线程与我的 Angular 同步时,使用:
navigator.serviceWorker.ready.then(function(swRegistration) {
console.log('swReady');
});
Run Code Online (Sandbox Code Playgroud)
什么也没发生,似乎 SW 没有与 Angular 通信。使用远程服务器(上传 dist)确实有效。所以似乎问题是 dist 无法使用ng serve. 我究竟做错了什么?
service-worker progressive-web-apps angular angular-service-worker
我在iPhone4,iOS7.1上运行SpriteKit游戏当我选择常规的RGBA888纹理图集格式时,它看起来不错,但是,当我尝试使用RGBA444_COMPRESSED时,所有图集纹理的大小都是显示器不是视网膜的两倍.
有任何想法吗?
angular ×5
javascript ×2
xcode ×2
angular-pipe ×1
css ×1
dead-code ×1
events ×1
express ×1
html ×1
html5-video ×1
ios ×1
ios7.1 ×1
ios8.3 ×1
ios8.4 ×1
node.js ×1
sprite-kit ×1
vimeo ×1
xcode6.3 ×1
xcode6.4 ×1