我希望在<ion-input>
进入页面时将焦点设置在我的上面
这是我的打字稿代码:
import { Component, Input, ViewChild,ElementRef,Renderer } from '@angular/core';
import { NavController, PopoverController, NavParams, ViewController, ModalController } from 'ionic-angular';
@Component({
selector: 'page-comments',
templateUrl: 'comments.html'
})
export class CommentsParentPage {
@ViewChild('input') myInput;
constructor(public navCtrl: NavController,private renderer: Renderer,
private elementRef: ElementRef, public modalCtrl: ModalController) {
}
ionViewLoaded() {
setTimeout(() => {
let element = this.elementRef.nativeElement.querySelector('input');
this.renderer.invokeElementMethod(element, 'focus', []);
},150);
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我对我的html
文件做的:
<ion-item>
<ion-input set-focuser type="text" placeholder="Write Your Comments" [(ngModel)]="addComment"></ion-input>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
每当我进入我的应用程序的这个页面时,我希望打开键盘并将焦点设置为开启 ion-input
我的config.xml
包括:
<preference …
Run Code Online (Sandbox Code Playgroud) 如果我考虑一个例子
https://app.abc.com/login
Run Code Online (Sandbox Code Playgroud)
这会在我的应用中打开登录页面。但是如果链接像
https://app.abc.com/loginUser //This link is a route in web app
Run Code Online (Sandbox Code Playgroud)
这不会在App中打开登录页面,因为路径未在路线中定义
现在的要求是,每当用户单击“第二”链接时,即使这样,它也应该在App中而不是在Web中打开登录组件。即。同一组件有多个路由,还是可以为此类路由打开通用组件?我们可以在React-Native中实现吗?
<a href= "" style="color: #666; ">{{postMessage}}</a>
Run Code Online (Sandbox Code Playgroud)
我得到{{postMessage}}
角度表达式,这个帖子消息是链接的形式,例如.www.google.com.
如果我不包括href
那么它显示为普通文本.如果我这样做,href=""
它会把我带到一个空白页面,这很明显.请帮助我解决一下如何使我的angular2表达式在html中作为链接工作的问题.
我有一个*ngFor,它给了我特定的商品清单,然后我点击一个特定的按钮来选择它们.当我点击我的选择按钮时,它暂时禁用按钮,直到我从后端得到响应.当我从后端得到我的回复时,该按钮变为活动状态以取消选择该项目.
我在这里遇到的问题是,当我点击选择按钮时,它会暂时禁用列表中的所有按钮.但我想要的是只禁用单击按钮.
我的HTML代码段:
<ion-card *ngFor="let list of list_Array;>
<ion-card-content >
<p style="color: #666; " [innerHTML]="list.item"></p>
</ion-card-content>
<button ion-button color="secondary" clear (click)="activeButton(list._id)" *ngIf="list.isAlreadyChosen==true" [disabled]="ChooseButton">
<div class="chosen"
ng-class="{'chosen': isChosen}">
<p >choose</p>
</div>
</button>
<button ion-button color="secondary" clear (click)="activeButton(list._id)" *ngIf="list.isAlreadyChosen==false" [disabled]="ChooseButton" >
<div class="choosen"
ng-class="{'chosen': isChosen}">
<p >choose</p>
</div>
</button>
</ion-card>
Run Code Online (Sandbox Code Playgroud) 我刚刚将离子2从离子2升级到离子3.但现在它被卡在闪屏上并出现错误:
找不到模块"d3"
这是我的离子信息:
Cordova CLI:6.4.0
Run Code Online (Sandbox Code Playgroud)Ionic Framework Version: 3.0.1 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.3.0 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.9.1 Xcode version: Not installed
的package.json
{
"name": "MyApp",
"author": "",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
//dependencies starts here. have updated these according to ionic 3
"@angular/common": "4.0.0", …
Run Code Online (Sandbox Code Playgroud) 我正在使用 react-navigation 并且根据我的应用程序的结构,我们在堆栈导航器中有一个选项卡导航器,我无法找到任何正确的实现深度链接的指南。
https://v1.reactnavigation.org/docs/deep-linking.html。这不会为嵌套导航器提供任何参考。
ionic2 ×4
angular ×3
html5 ×2
react-native ×2
typescript ×2
d3.js ×1
href ×1
html ×1
ionic3 ×1
javascript ×1