现在我使用:
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
Run Code Online (Sandbox Code Playgroud)
带出所有元素.但我需要带出4div元素.像这样:
<div>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
<app ngxSlickItem *ngFor="let item of items" [item]="item"></app>
</div>
Run Code Online (Sandbox Code Playgroud)
我怎么能用ngFor做到这一点?我有一个滑块,我需要在开始时显示4个元素.
此版本的Visual Studio无法在(Windows 7 32bit)中的Visual Studio 2015中打开以下项目(.deployproj)
Unsupported
This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them.
For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after clicking OK.
- AllInOneDeploy, "E:\Prakash\Proj-2112017\survey-platform-master\AzureAllInOneDeploy\AllInOneDeploy.deployproj"
- SetupBackups, "E:\Prakash\Proj-2112017\survey-platform-master\SetupBackups\SetupBackups.deployproj"
No changes required
These projects can be opened in Visual Studio 2015, Visual …
Run Code Online (Sandbox Code Playgroud) 我有2个函数来加载数据:当初始页面和搜索页面.当init页面时,数据显示有5页.我点击第3页,分页的数据显示确定.之后,输入数据搜索.数据表是重新加载的,但页码不会重置为1,它仍然是第3页的html:
<p-paginator rows="5" totalRecords="{{totalRecords}}" (onLazyLoad)="paginate($event)"
(onPageChange)="paginate($event)" [rowsPerPageOptions]="[2,5,10,20]"></p-paginator>
Run Code Online (Sandbox Code Playgroud)
TS:
defaultPage:0;
defaultSize:2
paginate(event) {
let currentPage: number;
this.defaultPage = event.first / event.rows;
this.defaultSize = event.rows;
this.listData = [];
if (this.isSearch == 1) {
this.getLoadPageSearch(this.defaultSize, this.defaultPage);
} else {
this.getLoadPage(this.defaultSize, this.defaultPage);
}
}
Run Code Online (Sandbox Code Playgroud)
请告诉我如何在调用另一个API后重置paginator
我的Web应用程序基于Angular,我尝试使用ngx-quill库将Quill集成到其中。我创建了仅包含不可修改的文本块(从数据库中检索到)的自定义嵌入污点,现在我尝试创建一个自定义工具栏,允许用户将该污点实例插入文本。
我的问题是,如何在Quill工具栏中创建自定义下拉菜单,在其中我可以提供自己的内容,这些内容将显示给用户并插入到文本中?
我尝试这样做:
<quill-editor>
<div quill-editor-toolbar>
<select class="ql-attribute">
<option *ngFor="let attribute of documentAttributes()"
[title]="document.data[attribute.id]"
(click)="onAddAttribute(attribute.id)">
{{attribute.name}}
</option>
</select>
</div>
</quill-editor>
Run Code Online (Sandbox Code Playgroud)
...但是下拉菜单中没有显示任何值。
看来这个问题已经为React和Plain JS解决了。但看起来这将是一个有点困难的角度这样做,尤其是当奎尔使用集成QuillEditorComponent提供通过NGX-鹅毛笔库。
我对Angular 2和打字稿都比较新.我想以角度2创建一个日志文件.可以使用角度2.
我在我的数据服务中获取 JSON 对象值,但所有组件都在我的数据服务加载之前加载。所以,当我从组件调用服务方法时,我得到了未定义的值。
我正在使用 firebase,我将图像存储在我的 firebase 存储上,然后在视图上显示这些图像,每个图像都有一个按钮,这个想法是当用户按下按钮时下载图像,到目前为止我该怎么做我一直无法找到使用 angular 的方法,在图像对象上,我存储了downloadUrl
上传图像时提供的火库,我想使用该 URL 下载图像
成分
<div class="wrapper-gallery" id="photos_container">
<div class="mix col-xs-12 col-sm-4 col-md-3 item-photo" *ngFor="let photo of couplePhotos | async | sortByFavorites: sortBy | sortByTime: sortBy">
<div class="photo">
<img class="img-fluid" src="{{photo.data.photo_url}}" alt="{{photo.data.name}}">
<button class="delete" (click)="deletePhoto(photo.id, photo.data.name)"><span class="icon-cross"></span></button>
<a class="search zoom" data-fancybox="wedding" href="{{photo.data.photo_url}}"><span class="icon-search"></span></a>
<button class="star" [ngClass]="{'start-on': photo.data.favorite == true}" (click)="toggleFavorite(photo.id, photo)"><span class="icon-star-full"></span></button>
<button class="download" (click)="downloadImg()"><span class="icon-download"></span></button>
<a [href]="photo.data.photo_url" download></a>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我是 ngOnchanges 的新手并面临以下问题。
我的父组件正在 ngOnChanges 上设置 recom 值并将相同的值发送到子组件。child 接收与 ngOnChanges 中的输入相同的内容。根据某些条件,例如 totalVal>0,我将 inputField 设置为 true,最初设置为 false。如果 inputField 为真,我会以反应形式显示一些组件。但是当我下面的结构执行 model2Form() 时,它仍然将 inputField 设为 false。我无法发布实际代码,所以只是根据我的项目创建了一个结构,如下所示。
请建议我如何解决这个问题。
// parent component
ngOnchanges(){
this.recom = [{
totalVal: 5000,
monthlydata: true
}]
}
//child component
@Input()
private recom: any;
inputField: boolean = false;
ngOnChanges(){
this.setValue();
this.loadFuture();
}
setValue(){
if(this.recom.totalVal > 0){
this.inputField = true;
}
}
loadFuture(){
}
model2Form(){
//getting input field as false even if i set it as true in setValue()
if(inputField){
this.heroForm.setControl('secretLairs', addressFormArray); …
Run Code Online (Sandbox Code Playgroud) 我想在登录表单中显示/隐藏密码文本。我有下面的代码。
我尝试以下代码:
<GridLayout margin="10" verticalAlignment="center" backgroundColor="#ffffff">
<StackLayout margin="10" verticalAlignment="center" [formGroup]="signUpForm" padding="15">
<StackLayout class="input-field">
<TextField formControlName="username" hint="Username"></TextField>
</StackLayout>
<StackLayout class="input-field">
<TextField formControlName="password" hint="Password" secure="true">
</TextField>
</StackLayout>
<Label text ="show/hide" (tap)="toggleShow()"></Label>
</StackLayout>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
在component.ts中,我编写了以下代码:
export class LoginComponent implements OnInit {
signUpForm: FormGroup;
show = false;
type= 'password';
constructor(....) {
this.signUpForm = this.formBuilder.group({
username: ["", Validators.required],
password: ["", Validators.required]
});
}
toggleShow()
{
this.show = !this.show;
if (this.show){
this.type = "text";
}
else {
this.type = "password";
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我点击功能toggleShow()
中 …
show-hide typescript nativescript angular2-nativescript angular
angular ×8
typescript ×4
angular-pipe ×1
firebase ×1
javascript ×1
nativescript ×1
ngx-quill ×1
primeng ×1
quill ×1
show-hide ×1