我正在实施分页,它需要集中.问题是链接需要显示为块,因此需要浮动它们.但是,text-align: center;对他们不起作用.我可以通过给左边的包装div填充来实现它,但是每个页面都有不同的页面数,所以这不起作用.这是我的代码:
.pagination {
text-align: center;
}
.pagination a {
display: block;
width: 30px;
height: 30px;
float: left;
margin-left: 3px;
background: url(/images/structure/pagination-button.png);
}
.pagination a.last {
width: 90px;
background: url(/images/structure/pagination-button-last.png);
}
.pagination a.first {
width: 60px;
background: url(/images/structure/pagination-button-first.png);
}Run Code Online (Sandbox Code Playgroud)
<div class='pagination'>
<a class='first' href='#'>First</a>
<a href='#'>1</a>
<a href='#'>2</a>
<a href='#'>3</a>
<a class='last' href='#'>Last</a>
</div>
<!-- end: .pagination -->Run Code Online (Sandbox Code Playgroud)
为了得到这个想法,我想要的是:

这个问题来自material2 github repo https://github.com/angular/material2/issues/4422#issuecomment-300309224
我仍然有问题来设置包装在自定义组件中的材质组件.
我有一个<logo>包含的组件<md-icon svgIcon="logo"></md-icon>
加入
:host {
.mat-icon {
width: 100px;
height: 100px;
font-size: 56px;
}
}
Run Code Online (Sandbox Code Playgroud)
不适用于我的自定义组件中的材质组件
这是我的代码:
$('.items').html(response).hide().fadeIn();
Run Code Online (Sandbox Code Playgroud)
问题是当加载它时页面"跳"起来,因为.hide()..还有其他方法可以做到这一点吗?
我正在研究从gulp/grunt切换到仅使用npm脚本.但我真的无法解决如何从给定路径获取*.js和*.css并将其添加到index.html文件中.
我必须通过"index.js"文件添加它,还是可以做类似......
"scripts": {
"inject": "inject src/app/*.js",
},
Run Code Online (Sandbox Code Playgroud)
然后它会将它添加到我的index.html中,我已经指定它...
/* inject:js */
Run Code Online (Sandbox Code Playgroud) 我刚开始测试"protocol less Urls"背后的想法.
我要解决的问题是:在https页面上我需要从http加载外部css文件.
以"正常"方式执行此操作会导致失败... css文件被阻止.(现在只用chrome测试).
所以我的问题是:"protocol less urls"会从http/https/both加载文件吗?
我有一个服务(AuthService),我需要在我的restangularInit函数(在我的 app.module.ts 中)中访问它,但我不知道如何访问它,我无法访问它。
我试图将它移动到 AppModule 类中,但到那时它\xc2\xb4s 已经晚了。
\n\n调用服务功能,例如。getToken按预期工作。
import { BrowserModule } from \'@angular/platform-browser\';\nimport { NgModule } from \'@angular/core\';\nimport { FormsModule } from \'@angular/forms\';\nimport { HttpModule } from \'@angular/http\';\nimport { MaterialModule } from \'@angular/material\';\nimport { FlexLayoutModule } from "@angular/flex-layout";\nimport { RestangularModule } from \'ng2-restangular\';\n\n// Components\nimport { AppComponent } from \'./app.component\';\nimport { ProductComponent } from \'./components/product/product.component\';\n\n// Services\nimport { AuthService } from \'./services/auth.service\';\n\nexport function restangularInit(RestangularProvider, AuthService) {\n console.log(AuthService); // this is undefined\n let token = …Run Code Online (Sandbox Code Playgroud) 我有这样的设置
api服务看起来像这样:
get<T>(url: string, options?) {
return this.httpClient.get<T>(this.apiUrl + url, this.getOptions(options));}
Run Code Online (Sandbox Code Playgroud)
在我的customer.service我有:
private fetchCustomer(access_token: String): Observable<Customer> {
const options = { headers: new HttpHeaders({ Authorization: 'Bearer ' + access_token }) };
return this.http
.get<Customer>('customers/me', options)
.map(res => {
const customer = res.data;
customer.access_token = access_token;
return customer;
})
.catch(this.handleError.bind(this));
}
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
[ts]
Property 'data' does not exist on type 'HttpEvent<Customer>'.
Property 'data' does not exist on type 'HttpSentEvent'.
Run Code Online (Sandbox Code Playgroud) 我有一个需要输入的组件.. @Input() coDeliveryCandidates: DeliverySlotView[];
这在模板中使用:
<ng-container *ngFor="let coDeliverySlotView of (coDeliveryCandidates | async)">
<button
mat-raised-button
[color]=""
>
{{ label }}
</button>
</ng-container>
Run Code Online (Sandbox Code Playgroud)
color 属性需要一个字符串作为值,我想做一些类似的事情:
[color]="{
black: coDeliverySlotView.slotId === bookedSlot.slotId,
grey: !coDeliverySlotView.slotId === bookedSlot.slotId
}"
Run Code Online (Sandbox Code Playgroud)
在这里,我使用与 ngClass 相同的语法,但我想它不支持这种方式..那么还有哪些其他类似的方式呢?:)
conditional-statements angular-material angular-components angular
所以我有这种形式,它工作正常..但现在我想扩展一些json结构...
https://plnkr.co/edit/aYaYTBRHekHzyS0M7HDM?p=preview
我想要使用的新结构看起来像这样(只有地址:已更改):
email: ['', [Validators.required, Validators.email]],
password: ['', [Validators.required, Validators.minLength(5)]],
address: this.fb.array([{
name: '',
addressLine1: ['', [Validators.required]],
city: ['', [Validators.required]],
postalCode: [Validators.required],
}]),
Run Code Online (Sandbox Code Playgroud)
但我不断收到错误,如"ERROR TypeError:control.registerOnChange不是函数".想通知这与formControlName缺失有关,但我不希望所有数据都显示..
在输入字段中,我只想显示addressLine1(根本不显示name,city或postalCode).
我只是觉得如果这2个查询会有很大的性能差异
SELECT
`items_id`, `sport_id`, `sport`, `title`, `url`,
`Select3`, `Select6`, `id`, `data`,`image` as image,
concat('index.php?option=sports&item=',`items_id`,'&p=C108-M108') as count_url
FROM
qy9zh_dataitems
WHERE Select6 LIKE '%sport%'
ORDER BY `Select9` DESC LIMIT 0, 4
SELECT
`items_id`, `sport_id`, `sport`, `title`, `url`,
`Select3`, `Select6`, `id`, `data`,`image` as image,
concat('index.php?option=sports&item=',`items_id`,'&p=C108-M108') as count_url
FROM
qy9zh_dataitems
WHERE Select6 in ('sport')
ORDER BY `Select9` DESC LIMIT 0, 4
Run Code Online (Sandbox Code Playgroud)
查询工作得很好..他们两个..只是担心性能:)
编辑:当我做一些测试时,一个奇怪的事情是:
SELECT * FROM qy9zh_dataitems WHERE Select6 in ('kvinna') LIMIT 0, 40000
Run Code Online (Sandbox Code Playgroud)
共计29,051次,查询耗时0.2581秒
SELECT * FROM qy9zh_dataitems WHERE Select6 LIKE ('%kvinna%') LIMIT …Run Code Online (Sandbox Code Playgroud)