我在我的应用程序中使用ng2-completer,当我们开始输入它将进行api调用时,它将从服务器获取其工作正常的记录.
问题是如果完成者获得超过50个条目,然后它重叠整个屏幕,我如何限制下拉长度?
我尝试了下面的CSS但它不起作用.
.completer-dropdown {
overflow-y: auto !important;
max-height: 100px !important;
}
Run Code Online (Sandbox Code Playgroud)
这是我的HTML代码.
<ng2-completer placeholder="Enter Your Locality Name" class="overlay" [dataService]="dataServiceForLocality" [minSearchLength]="3" [fieldTabindex]="2" [(ngModel)]="localityValue" (selected)="selectedLocality($event)" [textSearching]="'Please wait...'" formControlName="locality" style="height: 50px;" (keyup)="onKey($event.target.value)"></ng2-completer>
Run Code Online (Sandbox Code Playgroud)
您可以在此查看实时示例.
我正在阅读Douglas Crockford的书 - Javascript的好部分 - 他说:
JavaScript有一个数字类型.在内部,它表示为64位浮点,与Java的double相同.与大多数其他编程语言不同,没有单独的整数类型,因此1和1.0是相同的值.这是一个很大的便利,因为完全避免了短整数溢出的问题......
我不太熟悉其他语言,所以想要一点解释.我能理解为什么64位有帮助,但他的陈述似乎适用于缺少浮点数和双打.
什么是(伪代码)可能是JS中不会出现的短整数溢出情况的例子?
//假设我改变state的handleChange功能。
在onChange事件状态的情况下将更新每个字符更改。
<input
type="text"
name="name"
onChange={this.handleChange}
id="name"
/>
Run Code Online (Sandbox Code Playgroud)
如果onBlur事件状态将在离开输入字段后单次更新。
<input
type="text"
name="name"
onBlur={this.handleChange}
id="name"
/>
Run Code Online (Sandbox Code Playgroud)
哪种方法最适合更新statein React,为什么?
我需要显示位于对象数组中的数组质量.我试过ngFor使用下面的代码调用它.我的用法有问题ngFor吗?
import { Component} from '@angular/core';
@Component({
selector: 'my-app',
template: `<table>
<thead>
<tr>
<th>Name</th>
<th>Quality1</th>
<th>Quality2</th>
</tr>
</thead>
<tbody>
<tr *ngFor"let item of people">
<td>{{item.Name}}</td>
<td *ngFor"let item of people.quality">item.quality1</td>
<td *ngFor"let item of people.quality">item.quality2/td>
</tr>
</tbody>
</table>
})
export class AppComponent{
people: any = [{Name:"John", quality:[{quality1: "nice", quality2: "humble"}]}, {Name:"Dave", quality:[{quality1: "kind", quality2: "caring"}]} ];
}
Run Code Online (Sandbox Code Playgroud)
截至目前,只有名字出现在表格中,但我也希望质量出现.
我有一个表格内部ng-if指令.我想在控制器中检查表单验证$valid.
<div ng-if="paymentMethod == 12">
<form name="creditForm" id="cc-form" novalidate>
<div class="form-group">
<label for="cardNumber">Card Number</label>
<input type="text" autofocus class="form-control" name="card_number" ng-minlength="16" id="cardNumber" ng-model="creditCardNumber" required>
<div class="red-text" ng-messages="creditForm.card_number.$error" ng-if="creditForm.card_number.$dirty || creditForm.$submitted">
<div ng-message="required">##global.Card_Num_Required##</div>
<div ng-message="maxlength">##global.Card_Num_MinLength##</div>
<div ng-message="minlength">##global.Card_Num_MaxLength##</div>
<div ng-message="minlength">##global.Card_Num_Numeric ##</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
并尝试检查控制器中的有效表单
if ($scope.$parent.creditForm.$valid) {
alert('valid');
} else {
alert('not valid');
}
Run Code Online (Sandbox Code Playgroud)
但是控制器无法访问该表单.
我使用的开发移动应用程序angular2和ionic 2,我有3 buttons对call,sms并且email如下
<a ion-button href="tel:{{contact.cellphone}}" color="primary">
<ion-icon name="call"></ion-icon>
Call
</a>
<a ion-button href="sms:{{contact.cellphone}}" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>
<a ion-button href="mailto:{{contact.email}}" color="dark">
<ion-icon name="mail"></ion-icon>
Email
</a>
Run Code Online (Sandbox Code Playgroud)
Call并且email工作正常,但不是sms,似乎角度unsafe:在我的表达前面添加,它将变得像下面
<a color="secondary" ion-button="" ng-reflect-color="secondary" class="button button-md button-default button-default-md button-md-secondary" ng-reflect-href="unsafe:sms:+16475374201" href="unsafe:sms:+16475374201"><span class="button-inner">
Run Code Online (Sandbox Code Playgroud)
即使我试过这个
<a ion-button [attr.href]="'sms:'+contact.cellphone" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>
Run Code Online (Sandbox Code Playgroud)
还是一样的问题,
当我不使用角度绑定时,它工作正常,例如像这样
<a ion-button href="sms:+1647654654" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>
Run Code Online (Sandbox Code Playgroud)
虽然它与角度有关,但我也检查了我的config.xml并且 …
React-Native-Elements 图标显示为 (?)
我究竟做错了什么?该代码看起来与他们在其站点上提供的示例几乎相同。
我用于左侧图标的代码:
<Icon name='users' type='Feather' size={25} color={tintColor} />
Run Code Online (Sandbox Code Playgroud)
右侧图标的代码:
GamesInProgressTab: {
screen: GamesInProgressNavigator,
navigationOptions: {
title: 'Games',
tabBarIcon: ({ tintColor }) => ( <Icon name='rocket' type='Entypo' size={25} color={tintColor} /> ),
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在这个Angular 2 项目中使用AOT编译器。当我执行命令时出现错误:不是一个函数:。如何解决这个问题?TypeError: this.compiler.compileModules"node_modules/.bin/ngc" -p tsconfig-aot.json
重现步骤:
克隆此存储库:https://github.com/AngularClass/angular2-webpack-starter
安装compiler-cli(版本2.1.2):npm install @angular/compiler-cli --save
从中删除src/app/+detail目录和detail路由器src/app/app.routes.ts(我这样做是因为"node_modules/.bin/ngc" -p tsconfig-aot.json输出错误can't resolve module src/app/+detail/index.ts from src/app/+detail/index.ts:)
创造tsconfig-aot.json:
{“compilerOptions”:{“target”:“es5”,“module”:“es2015”,“moduleResolution”:“node”,“sourceMap”:true,“emitDecoratorMetadata”:true,“experimentalDecorators”:true,“removeComments ": false, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true },
"angularCompilerOptions": { "genDir": "aot", "skipMetadataEmit" : true } }
跑步"node_modules/.bin/ngc" -p tsconfig-aot.json
我想在FFMPEG执行android时添加进度条。
当我启动FFMPEG命令时,进度条将从进度百分比开始。
我想在新窗口中打开一个URL,在x秒之后或页面完成加载后我想再次关闭它.
我现在正在使用:
window.open('http://otherurl.com', 'newwindow', 'width=300, height=250'); return false;
Run Code Online (Sandbox Code Playgroud)
'otherurl'不是域名,因此我无法控制该URL.
我怎样才能做到这一点?
我是javascript的新手.当我使用对象和嵌套循环时.有弹药可供选择
var a = [{b:[{c:null}]}]
for(var x= 0 ; x<10;x++){
for(var y= 0 ; y<10;y++){
console.log(a);
a[x].b[y].c = y;
console.log(a);
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误就像TypeError: Cannot set property 'c' of undefined有人可以解释为什么它这样工作.我本来想要这样
a[0].b[0].c = 1;
a[0].b[1].c = 2;......
a[1].b[0].c = 1;....
a[9].b[9].c = 9;
Run Code Online (Sandbox Code Playgroud) angular ×4
javascript ×4
angularjs ×2
android ×1
angular2-cli ×1
arrays ×1
css ×1
ffmpeg ×1
for-loop ×1
ionic2 ×1
nested-loops ×1
ngfor ×1
object ×1
onblur ×1
onchange ×1
progress-bar ×1
react-native ×1
reactjs ×1
typescript ×1
url ×1