我尝试使用hammerjs的类型定义。作为:
import Hammer from 'hammerjs';
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
错误 TS2307:找不到模块“hammerjs”
我有两个问题。首先,有必要在github中获取所有tile定义文件,我们可以获得hammerjs的简单定义吗?
我的 package.json 包含:
"dependencies": {
"git+https://git@github.com/DefinitelyTyped/DefinitelyTyped.git"
}
Run Code Online (Sandbox Code Playgroud)
第二个问题,我关于导入模块的错误是什么?
我想知道多个请求是否:
如果我$http request 1开始,让我们说$http request 1结束并试图打电话$http request 2。我的问题如何创建多个请求?
例如:调用$http request 1then $http request 2。
当我不断向导航堆栈添加页面时,会创建越来越多的 SimpleComponent 类实例。出于这个原因,我不止一次订阅“ev”事件并不止一次触发代码。
您可以通过在我的 plunker 示例中转到“那里”和“返回”并在不同情况下触发事件来检查这一点(检查控制台警告以获取结果)。您还可以看到,即使您回到导航堆栈的顶部,您仍然拥有订阅。
ionViewWillLeave 不工作可能是因为它不是我要离开的实际视图
我想知道我该怎么做才能避免这种情况?我希望像旧式 AngularJS 指令一样包含 SimpleComponent,因为我在我的应用程序中多次使用它。
export class SimpleComponent {
constructor(private ev: Events) {
this.ev.subscribe('ev', e => {
console.warn(e[0]);
});
}
}
// home.ts template
<simple-component></simple-component>
<button (click)="go()">Go next page</button>
<button (click)="raiseEv()">Raise Event</button>
Run Code Online (Sandbox Code Playgroud) 当我列出插件 ( cordova plugin list) 时,它会列在那里,但是当我在 android 设备上运行我的代码时,我在控制台中收到此消息(来自 chrome 远程调试器):
Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.
我有最新版本的 ionic-cli。
我在这里包含了一个示例项目:https : //github.com/golear91/ionic2-broken-inappbrowser
我基本上:
cordova plugin add cordova-plugin-inappbrowserInAppBrowser我尝试使用插件删除并重新安装无济于事。
关于什么是错误的任何想法?
我正在使用 ionic 2 rc0 和 angular 2,我刚刚添加了 angularfire2 以使用 firebse auth。
我已经完成所有配置和测试(我只看到我的用户登录了 firebase 控制台),但我想在登录后重定向到其他页面。
我的登录代码:
registerUserWithGoogle() {
console.log('Google');
this.af.auth.login();
}
Run Code Online (Sandbox Code Playgroud)
我的 Firebase 配置是:
export const myFirebaseAuthConfig = {
provider: AuthProviders.Google,
method: AuthMethods.Redirect
};
Run Code Online (Sandbox Code Playgroud)
那么有没有办法在方法 login() 之后重定向?
firebase firebase-authentication ionic2 angularfire2 angular
我有一个问题,因为在我的应用程序中,我需要输入登录名和密码才能访问,当我访问并按下智能手机的物理按钮返回并离开我的应用程序时,如果我再次访问出现登录页面,所以...我的应用程序不'不记得用户名和密码。有人知道我该如何解决?提前致谢。
此致。
所以问题是指定message的不在facebook模式共享窗口中,它是空的没有任何文本。
import {SocialSharing} from 'ionic-native';
...
shareFb(message?: string){
SocialSharing.shareViaFacebook(message,null,null).then(()=>{
//Success
},
()=>{
//cancel
});
}
<ion-icon name="logo-facebook"
class="share-facebook" (click)="shareFb(message.description)">
</ion-icon> <ion-icon ios="logo-twitter" md="logo-twitter"></ion-icon>
Run Code Online (Sandbox Code Playgroud) 所以我对 Ionic2 很陌生,所以我遇到了一些新手问题=/我几乎搜索了所有内容,但找不到任何示例。
我想要做的是将文件写入设备的某个目录。我正在使用 Ionic2,并且我已经看到有一个“文件 API ”可以满足我的需求。但问题是我无法设置它。
每当我这样做时,$ npm install --save @ionic-native/file我都会得到以下输出:
`project@0.0.1 D:\project\
+-- UNMET PEER DEPENDENCY @angular/core@2.2.1
+-- UNMET PEER DEPENDENCY @ionic-native/core@^3.1.0
+-- @ionic-native/file@3.2.1
-- UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12`
`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic-native/file@3.2.1 requires a peer of @ionic-native/core@^3.1.0 but none was installed.
npm WARN @ionic-native/file@3.2.1 requires a peer of @angular/core@2.4.8 but none was installed. …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular/Firebase在Ionic中构建应用程序.
我想在我的Android设备上测试应用程序,以前已经完美运行了.但是,最近我因为收到错误而无法运行它.
$ ionic cordova run android --device --prod
Run Code Online (Sandbox Code Playgroud)
然后会导致错误:
Running app-scripts build: --prod --platform android --target cordova
[15:36:05] build prod started ...
[15:36:05] clean started ...
[15:36:05] clean finished in 6 ms
[15:36:05] copy started ...
[15:36:06] deeplinks started ...
[15:36:06] deeplinks finished in 270 ms
[15:36:06] ngc started ...
[15:36:19] ngc finished in 12.61 s
[15:36:19] preprocess started ...
[15:36:19] preprocess finished in 1 ms
[15:36:19] webpack started ...
[15:36:19] copy finished in 13.84 s
[15:37:27] webpack finished …Run Code Online (Sandbox Code Playgroud) 我试图在typescript类中导入json文件
import * as nationalities from './mock/nationalities.json';
Run Code Online (Sandbox Code Playgroud)
它给了我一个错误
找不到模块'./mock/nationalities.json'.
为了解决这个问题,我添加了这个
declare module '*.json' {
const value: any;
export default value;
}
Run Code Online (Sandbox Code Playgroud)
但它没有解决我的问题,也给了我另一个错误异常
增强中的模块名称无效,无法找到模块'*.json'.
我的打字稿版本
2.9.2