我希望div使用css从角度2向右滑入.
<div class="note" [ngClass]="{'transition':show}" *ngIf="show">
<p> Notes</p>
</div>
<button class="btn btn-default" (click)="toggle(show)">Toggle</button>
Run Code Online (Sandbox Code Playgroud)
如果我只使用[ngClass]切换类并使用不透明度,我工作正常.但是李不希望从一开始就渲染这个元素,所以我首先用ngIf"隐藏"它,但是转换不会起作用.
.transition{
-webkit-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
-moz-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
-ms-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out ;
-o-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
margin-left: 1500px;
width: 200px;
opacity: 0;
}
.transition{
opacity: 100;
margin-left: 0;
}
Run Code Online (Sandbox Code Playgroud) 到目前为止,我可以用角度cli创建的最小的捆绑是运行
ng build --aot true -prod
我想知道构建过程是否也删除了未使用的CSS类,例如从bootstrap?
如果不是,我怎么能添加像purifycss这样的库?
编辑2018年4月
我仍然没有找到任何令人满意的解决方案来解决他的问题,特别是与带有角度的延迟加载模块兼容的解决方案...
干杯
嗨,我有一个可观察的用户$,有很多属性(名称,标题,地址......)
component{
user$:Observerable<User>;
constructor(private userService:UserService){
this.user$ = this.userService.someMethodReturningObservable$()
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在html模板中使用异步管道来订阅它并将其绑定到这样的局部变量
<div #user="user$ | async">
<h3> {{user.name}}
</div>
Run Code Online (Sandbox Code Playgroud)
我知道可以在构造函数中订阅它然后在OnLeave/OnDestroy中取消订阅但我只是好奇我是否可以使用异步管道.
干杯
pipe local-variables typescript angular2-observables angular
我正在尝试使用angular2的动画,我想知道它们对标准css动画/过渡有什么特别的优势.
例如,典型的材料设计卡和悬停效果与框阴影.大多数css框架使用:hover和css-transitions.使用角度2动画有特别的优势吗?
我在某处读到某些css动画属性并没有调用GPU那么多,因此有一些延迟和滞后.angular2动画怎么样?
我有一个父服务,有一些依赖,如
@Injectable()
export class ParentService{
constructor(private http:Http, private customService:CustomService){}
}
Run Code Online (Sandbox Code Playgroud)
我想扩展服务
@Injectable()
export class ChildService extends ParentService{
constructor (){
super(??) <= typescript now asking to enter two parameters according to ParentServie's constructor
}
}
Run Code Online (Sandbox Code Playgroud)
编辑 - - - - - - - - -
@Injectable()
export class ParentService{
constructor(private http:Http, private customService:CustomService){}
get(){this.http.get(...)}
}
@Injectable()
export class ChildService extends ParentService{
constructor (private http:Http, private customService:CustomService){
super(http, customService)
}
}
Run Code Online (Sandbox Code Playgroud)
然后我可以在组件中使用?
export class Cmp {
constructor(private childService:ChildService){
this.childService.get()
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个关于变化检测的简单问题.
我有一个组件和一个(全局)服务,里面有一个布尔值.如果该布尔值发生变化,如何让组件监听该布尔值并执行函数?
谢谢!
我为angular 2创建了一个打字稿库,便于访问我的后端服务.
到目前为止它是一个私人仓库,但我想将它作为开源库上传到github并在npm上注册.
我现在不确定该怎么做,因为关于这个主题的文档不容易找到.
文件夹结构如下所示:
src
|--sdk.ts // entry point
|--services
|--auth.ts
|--database.ts
|--5 more ts files
|--utils
|--utils.ts
|--interfaces.ts
|--tests (8 ..spec.ts files)
Run Code Online (Sandbox Code Playgroud)
我的入口点(sdk.ts)看起来像这样
import { NgModule, ModuleWithProviders } from '@angular/core';
import { Injectable } from '@angular/core';
import { SelfbitsDatabase } from './services/database';
import { SelfbitsAuth } from './services/auth';
import { SelfbitsAppConfig } from './utils/interfaces';
import { SelfbitsFile } from './services/file';
import { SelfbitsUser } from './services/user';
import { SelfbitsDevice } from './services/device';
import { SelfbitsPush } from './services/push'; …Run Code Online (Sandbox Code Playgroud) 有没有办法使用角度cli的AOT?
我已经安装了模块(@ angular/compiler @ angular/compiler-cli),当我输入ngc -p scr时,它会创建ngFactory.ts文件并将其编译为dist/tsc-out(tsconfig中的angular cli默认值)
不知道如何从这里开始:)
干杯
韩
在Ionic 3中,您可以使用navController的第二个参数将数据传递到下一页并使用navParams服务检索它.
这是一个非常方便的功能.在Ionic 4中是否有等效的路由api?
你总是可以JSON.stringify对象/数组到routerParams,这在我看来不太方便.
在Ionic 4中,您可以使用ComponentProps和@Input()通过modalController传递数据,使其更适合快速推送/弹出实现.
编辑
我对这个问题的意图是找出是否有来自Angular 6+或Ionic 4+的原生API.我很清楚如何实现自定义服务或解析器来实现此目的.
目标是充分利用离子和角度的api,因为在较大的项目中,每个自定义代码都需要文档并增加复杂性.
我有一个简单的聊天界面,但当我对输入文本区域进行聚焦时,键盘会推动所有内容,包括标题.内容区域的最顶层内容也隐藏了,我无法向上滚动到它们.
这仅适用于ios.
<ion-header></ion-header>
<ion-content>
Chat Title...
Chat Messages...
</ion-content>
<ion-footer>
<ion-card class="chat-input">
<textarea appAutoresize class="chat-input-textarea" rows="1" [(ngModel)]="input" placeholder="Ihre Nachricht"></textarea>
</ion-card>
</ion-footer>
Run Code Online (Sandbox Code Playgroud) angular ×9
css ×3
typescript ×3
angular-cli ×2
webpack ×2
angular2-aot ×1
bundler ×1
cordova ×1
extends ×1
ionic2 ×1
ionic4 ×1
keyboard ×1
minify ×1
npm ×1
performance ×1
pipe ×1