而不是像这样的东西
$('#submitbutton').click(function(e) {
e.preventDefault(); //to avoid the submit button to reload the page and go page to page one.
/* computing dimensions */
});
Run Code Online (Sandbox Code Playgroud)
我想把我的功能放在其他地方,比如:
$('#submitbutton').click(computeUserDimensions);
function computeUserDimensions(){
/* computing dimensions */
}
Run Code Online (Sandbox Code Playgroud)
但后来我不在哪里preventDefault提供点击(在提交按钮上)转到另一个页面.
你能帮我搞清楚吗?
谢谢
在我的离子应用程序中,有一个我需要使用的标签
$translateProvider.useSanitizeValueStrategy('sanitize');
Run Code Online (Sandbox Code Playgroud)
因为翻译字段中有html(translation-fr.js):
"recommendedboard": "Prefer a <span class=\"animateFUN\">SMALL-WAVE</span> board</span>"
Run Code Online (Sandbox Code Playgroud)
但是还有其他一些我需要使用的地方
$translateProvider.useSanitizeValueStrategy('escape');
Run Code Online (Sandbox Code Playgroud)
因为在法语翻译中,有些字母有重音,例如:
"31": "Modèle"
Run Code Online (Sandbox Code Playgroud)
我现在找到的唯一解决方案是使用该null策略.有没有办法同时使用这两种策略,或者为每种翻译指定策略?
我在index.html中有这个:
<meta charset="utf-8">
Run Code Online (Sandbox Code Playgroud)
我检查了翻译fr.js文件:
$ file -bi www/js/dicts/translation-fr.json
text/plain; charset=utf-8
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在使用jquery-mobile,我有这两个按钮:
<p id="propart">Pro:
<select id="chosenpro" data-inline="true"></select>
<button type="button" id="resetbutton" data-inline="true" data-theme="w">Reset</button>
</p>
Run Code Online (Sandbox Code Playgroud)
我希望它们并排显示(内联).但我无法弄明白.我做了这个,但它不起作用.你能帮我吗 ?这是我的css:
#propart .ui-select {
width:75%;
}
#propart .ui-select .ui-btn-icon-right {
width:100%;
}
#propart .ui-btn {
width:25%;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 Ionic (1 !) 开发一个应用程序并ionic serve用于在 Chrome 上对其进行测试。我想在 Chrome 开发工具设备模式下显示 iPhone 的状态栏(电池、时间和连接)。
有谁知道Chrome是否可以做到这一点?
google-chrome statusbar google-chrome-devtools ionic-framework
我有一个对象"响应",我想用响应的内容填充另一个对象"user",如下所示:
var userr = {
_id: new Date().toISOString()
, authVia: "FB"
, email: response.email
, firstName: response.first_name
, lastName: response.last_name
, gender: response.gender
, hometown: response.hometown.name
, fbId: response.id
, locale: response.locale
, location: response.location.name
, timezone: response.timezone
, fbVerified: response.verified
};
Run Code Online (Sandbox Code Playgroud)
但有时response.hometown未定义,代码在日志控制台中没有任何错误就停止了.在填充"用户"之前或填充"user"时,如何检查每个对象是否以简单的方式定义?是否可以在对象中插入"if"?
谢谢
我试图在 AngularJS/Ionic 页面中定位一个<div>绝对使用bottom=50%,如下所示:
HTML:
<ion-view title="BoardLine">
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-content class="has-header">
<div id="imagecontainer">
<img id="boardimage" ng-src="{{mainResultImagePath}}" />
<div id="photocredits" class="rotateimagecredits">
Image courtesy: {{computed.prophotocredits}}</div>
</div>
....
Run Code Online (Sandbox Code Playgroud)
CSS:
#imagecontainer {
position:absolute;
top:3%;
left:0;
right:62%;
bottom:50%;
}
#boardimage {
position:absolute;
left:10%;
max-width:85%;
bottom:0;
height:100%;
}
Run Code Online (Sandbox Code Playgroud)
但就在 之前div id="imagecontainer",Ionic 生成一个div class="scroll",如下所示,高度为 20px。我的顶部和底部 cssimagecontainer指的是这个高度,但div class="scroll" 有一个position:static. 因此,我的imagecontainer绝对定位应该是指具有非静态位置的第一个父级,
它应该是<ion-content>
<ion-content class="scroll-content ionic-scroll has-header"> …Run Code Online (Sandbox Code Playgroud) 我正在使用ngFor创建一个包含可点击图标的项目列表。
当我点击一个图标时,它会调用一个函数来更新后端的变量,成功时,我希望图标改变颜色。
如何“双向”绑定可迭代变量,obj以便当我在控制器中修改它时,它会反映在模板中?
模板:
<ion-item *ngFor="let obj of contactList | separator "
(click)="show_memories(obj.key, obj.bookName)" class="task-snoozed" no-lines>
<button ion-button icon-only clear
(click)="$event.stopPropagation(); sendChangeState(obj, 'toBe', obj.toBeAlerted)">
<ion-icon name="arrow-dropleft-circle" size="large"
[color]="obj.toBeAlerted ? 'primary' : 'gray-light'"></ion-icon>
</button>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
控制器:
sendChangeState(contact:any, alertType:string, bool:boolean){
this.firestoreService.changeAlertState(this.userId, contact.key, alertType, bool)
.then(() => {
//update the icon color here:
contact.toBeAlerted = !contact.toBeAlerted;
});
}
Run Code Online (Sandbox Code Playgroud)