我正在使用CSS媒体查询处理响应式网站.
以下是设备的良好组织吗?电话,Ipad(风景和肖像),桌面和笔记本电脑,大屏幕
什么是常见的媒体查询断点值?
我打算使用以下断点:
你怎么看?我有几个疑问?点.
我正在尝试使用CSS3媒体查询来创建一个只在宽度大于400px且小于900px时出现的类.我知道这可能非常简单,我遗漏了一些明显的东西,但我无法弄明白.我想出的是以下代码,感谢任何帮助.
@media (max-width:400px) and (min-width:900px) {
.class {
display: none;
}
}
Run Code Online (Sandbox Code Playgroud) 使用新的Angular-Material版本,您需要为Angular-Animations添加模块.您可以在两个BrowserAnimationsModule和NoopAnimationsModule之间进行选择.在官方指南中指出:
某些Material组件依赖于Angular动画模块,以便能够执行更高级的过渡.如果您希望这些动画在您的应用中运行,则必须安装@ angular/animations模块并在应用中包含BrowserAnimationsModule.
Run Code Online (Sandbox Code Playgroud)npm install --save @angular/animations import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; @NgModule({ ... imports: [BrowserAnimationsModule], ... }) export class PizzaPartyAppModule { }如果您不想为项目添加其他依赖项,则可以使用NoopAnimationsModule.
Run Code Online (Sandbox Code Playgroud)import {NoopAnimationsModule} from '@angular/platform-browser/animations'; @NgModule({ ... imports: [NoopAnimationsModule], ... }) export class PizzaPartyAppModule { }
我不太明白这里有什么区别.似乎完全一样:)两个模块之间有什么区别?
我目前正在尝试设计一个兼容多种屏幕尺寸的布局.我正在设计的屏幕尺寸如下:
屏幕尺寸:
我遇到的问题是创建css3媒体查询,以便当窗口的宽度达到其中一个宽度时,我的布局会发生变化.下面是我正在使用的媒体查询的示例,但它不适合我,所以我想知道是否有人可以帮我修复它.
<link rel="stylesheet" type="text/css" media="screen and (max-width: 700px)" href="css/devices/screen/layout-modify1.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 701px) and (max-width: 900px)" href="css/devices/screen/layout-modify2.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 901px)" href="css/devices/screen/layout-modify3.css">
Run Code Online (Sandbox Code Playgroud)
我尝试使用一组新的媒体查询,但它们仍然不适合我.请有人帮忙解释一下我的错误.你们当中有几个人已经尝试过解释,但我没有得到它.新媒体查询显示如下:
<link rel="stylesheet" type="text/css" media="screen and (max-width: 640px)" href="css/devices/screen/layout-modify1.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 800px)" href="css/devices/screen/layout-modify2.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 1024px)" href="css/devices/screen/layout-modify3.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 1280px)" href="css/devices/screen/layout-modify4.css">
Run Code Online (Sandbox Code Playgroud) 我通过动画添加了一个动画
@Component({
....,
animations: [
trigger('slideIn', [
...
])
],
host: {
'[@animation]': 'condition'
}
}
Run Code Online (Sandbox Code Playgroud)
哪个运作良好,在编译时我被告知这已被弃用,我应该使用@HostBinding ......
@HostBinding('[@animation]') get slideIn() {
return condition;
}
Run Code Online (Sandbox Code Playgroud)
这让我错了
Can't bind to '[@animation' since it isn't a known property of 'my-component-selector'.
Run Code Online (Sandbox Code Playgroud)
但我无法在我的模块中添加动画..我该怎么办?
我试图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管道添加一些额外的功能.
即.在货币管道上完成了一些额外的格式化.为此,我想在自定义管道的组件代码中使用现有管道.
有什么办法可以做到吗?
@Pipe({name: 'formatCurrency'})
export class FormatCurrency implements PipeTransform {
transform(value:number, args:string[]) : any {
var formatted = value/100;
//I would like to use the basic currecy pipe here.
///100 | currency:'EUR':true:'.2'
return 'Do some extra things here ' + formatted;
}
}
Run Code Online (Sandbox Code Playgroud) 我对AngularJS有疑问.如果我使用xeditable
<a editable-number="some.object"....
Run Code Online (Sandbox Code Playgroud)
我无法输入浮点数...那么,如何添加浮点数并在视图中进行浮点验证?
我试图在我的角度4应用程序中显示数字格式.基本上我正在看的是,如果数字是12.23百万,那么它应该显示例如12.2M(小数点后一位)
如果数字是50,000.123那么50.1K
我如何在角度上实现这一点.我需要写一个指令吗?有角度的内置管道吗?
结构体
export interface NpvResults {
captiveInsYear: number[];
captiveInsPremiumPaid: number[];
captiveInsTaxDeduction: number[];
captiveInsLoanToParent: number[];
captiveInsCapitalContribution: number[];
captiveDividentDistribution: number[];
captiveInsTerminalValue: number[];
}
Run Code Online (Sandbox Code Playgroud)
该数组初始化为以下值
this.sourceResults.captiveInsPremiumPaid = [1,2,3,4,5];
Run Code Online (Sandbox Code Playgroud)
HTML
<td *ngFor= "let item of NpvResults.captiveInsPremiumPaid" >{{item}}</td>
Run Code Online (Sandbox Code Playgroud) 我想在输入控件中使用角度2使用日期选择器弹出窗口,当输入控件上模糊时,然后日期选择器弹出应该像bootstrap datepicker,我想在角度2做,请建议我任何参考日期 - Angular 2的选择器.