我找到了这个解决方案 有效吗?
import {Component} from '@angular/core';
import {Platform} from 'ionic-angular';
@Component({...})
export MyApp {
constructor(platform: Platform) {
platform.ready().then((readySource) => {
console.log('Width: ' + platform.width());
console.log('Height: ' + platform.height());
});
}
}
Run Code Online (Sandbox Code Playgroud)
这种解决方案适用于离子2.我还可以用于角2吗?
请建议我正确的方法.
我有一个独特的数据列表:
假设我有以下数据:
id name
1 Jhon
2 Peter
3 Mark
4 Scotty
5 Marry
Run Code Online (Sandbox Code Playgroud)
我制定了一个.htaccess规则id:
RewriteRule brandlisting/(.*)/ site/brandlisting?id=$1 [L]
RewriteRule brandlisting/(.*) site/brandlisting?id=$1 [L]
Run Code Online (Sandbox Code Playgroud)
我的网址是:
http://localhost/mate/admin/site/brandlisting/3
Run Code Online (Sandbox Code Playgroud)
这适用于id.
现在我需要一个.htaccess名称规则,所以我为它制定了一个规则:
RewriteRule brandlisting/(.*)/ site/brandlisting?name=$1 [L]
RewriteRule brandlisting/(.*) site/brandlisting?name=$1 [L]
http://localhost/mate/admin/site/brandlisting/Mark
Run Code Online (Sandbox Code Playgroud)
当我使用上述URL时,我在控制台中面临以下错误:
"NetworkError:400 Bad Request - http:// localhost/mate/admin/site/brandlisting/Mark "
并在浏览器中显示:
错误400您的请求无效.
我目前的.htaccess文件
RewriteEngine on
RewriteCond %{HTTP_HOST} ^localhost/mate/admin$ [NC,OR]
RewriteCond %{HTTP_HOST} ^localhost/mate/admin$
RewriteCond %{REQUEST_URI} !wordpress/
RewriteRule (.*) /wordpress/$1 [L]
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond …Run Code Online (Sandbox Code Playgroud) 当我导入数据库时,所有表都已成功导入,但是当我尝试访问“视图”时,我在 phpmyadmin 的屏幕上收到以下消息
references invalid table(s) or column(s) or function(s)
or definer/invoker of view lack rights to use them
Run Code Online (Sandbox Code Playgroud)
请告诉我那里有什么问题?
我更新离子并尝试添加android和ios平台,但我无法添加它.它在控制台中向我显示以下消息.
js20@js20:~/Desktop/project$ ionic platform add android
The platform command has been renamed. To find out more, run:
ionic cordova platform --help
Run Code Online (Sandbox Code Playgroud)
我的离子版
js20@js20:~/Desktop/project$ ionic -v
3.3.0
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码向设备发送推送通知。
var nTitle = "New message from " + $rootScope.clients_firstName;
var to = "DeviceToken is here";
var notification = {
'title': nTitle,
//'body': 'Click here to more details...',
'icon': 'firebase-logo.png',
'click_action': 'openapp'
};
var key = 'your key';
fetch('https://fcm.googleapis.com/fcm/send', {
'method': 'POST',
'headers': {
'Authorization': 'key=' + key,
'Content-Type': 'application/json'
},
'body': JSON.stringify({
'notification': data,
'to': to
})
}).then(function(response) {
//console.log("res ", response);
}).catch(function(error) {
console.error("err ", error);
});
Run Code Online (Sandbox Code Playgroud)
推送通知在设备上成功发送。
但是,当我单击通知时,应打开特定页面。
例如 'click_action' : 'openapp/somepage'
然后,当我单击pushnotification时,应该打开“ somepage”。
AndroidManifest.xml
<activity android:name="MainActivity" …Run Code Online (Sandbox Code Playgroud) 我们有一个现有的 Cordova iOS 应用程序,我们需要一个 iOS 共享扩展程序,它允许用户与我们的应用程序共享来自其他应用程序(如照片、页面、数字、主题演讲等)的文件(即将文件从页面导出到我们的应用程序) )。
我们需要提供以下物品:
我尝试安装npm包.所有包都安装正确.但是当我尝试使用npm start当时运行应用程序时,出现以下错误:
错误在./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/sass-loader/ lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./ src/styles.scss模块构建失败:
未定义
^
Mixins可能未在控制指令或其他内定义混入.
在D:\ DailyJS\CIDE_SCHOOL_DEV \node_modules\@angular\material_theming.scss(第2440行,第10列)
错误:
未定义
^
Mixins可能未在控制指令或其他mixin中定义.
在D:\ DailyJS\CIDE_SCHOOL_DEV \node_modules\@angular\material_theming.scss(第2440行,第10行)
的options.error(D:\ DailyJS\CIDE_SCHOOL_DEV \node_modules \node-sass\lib\index.js:291:26) )@ ./src/styles.scss 4:14-187
@ multi ./node_modules/font-awesome/scss/font-awesome.scss ./src/styles.scss
webpack:无法编译.
我不知道为什么会这样?以前我从Github克隆了存储库,然后使用安装了npm软件包npm install.然后它奏效了.
但今天,它给出了这个错误:
Mixins可能未在控制指令或其他mixin中定义.
每当我使用 forEach() 时,我都会在终端中收到此错误
[ts] Property 'forEach' does not exist on type 'string'.
Run Code Online (Sandbox Code Playgroud)
我的应用程序在浏览器中正常工作。一切正常,但我不希望终端出现此类错误。
我使用了下面的代码。请建议我我错过了什么。
job.forEach(function(state) {
if((totalcarer['userId']+"")===state.rNo)
{
cjobState = state.cJobstatus;
}
});
Run Code Online (Sandbox Code Playgroud) 我做了离子应用.仍然可以在iOS-9和iOS-10中完美运行.
今天,我将iOS-10更新为iOS-11,我还将xcode-8更新为xcode-9.
iOS-11中存在一个奇怪的问题.有关该问题,请参见下图.
当我在xcode8和ios10中构建应用程序时,标题/ stautsbar没有出现.
但是,当我将xcode8更新为xcode9并将ios10更新为ios11时,会出现此问题.
请告诉我,我应该如何隐藏它或使其透明.
提前致谢
当我从firebase获取数据时,我正在尝试重定向.如果它为null或空,则无需重定向.
我正在尝试使用this.navCtrl.push(ProspectPage);但不知道为什么它不工作它返回一个错误
TypeError: this is null
这是我的代码,请检查一下,让我知道我在这里做错了什么.
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ProspectPage } from '../prospect/prospect';
import * as firebase from 'firebase';
@Component({
selector: 'page-credentials',
templateUrl: 'credentials.html'
})
export class CredentialsPage {
constructor(public navCtrl: NavController) {
}
register(params){
// this.navCtrl.push(ProspectPage); // if i wrote here then it works
ref.orderByChild("ssn").equalTo(1234).on("value", function(snapshot) {
if(snapshot.val())
{
this.navCtrl.push(ProspectPage);
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
看register()有一条评论.如果我this.navCtrl.push(ProspectPage);在函数的开头添加,那么它的工作原理.但是当我从firbase获取数据时它应该工作.
在这里,是我的HTML代码.
<button id="credentials-button1" ion-button color="stable" block on-click="register()"> Lets …Run Code Online (Sandbox Code Playgroud) angular ×3
typescript ×3
.htaccess ×1
android ×1
cordova ×1
firebase ×1
ionic-cli ×1
ionic2 ×1
ionic3 ×1
ios ×1
ios11 ×1
javascript ×1
mod-rewrite ×1
mysql ×1
node-sass ×1
php ×1
phpmyadmin ×1
xcode ×1
xcode9 ×1