小编Ale*_*ios的帖子

Ionic with Android Emulator:自动发送位置?

我的android模拟器有问题.当我关闭并重新打开我的应用时,该位置不会自动发送.我必须进入扩展控件 - >位置,然后单击Ionic Geolocation getCurrentPosition函数的"发送"按钮来接收它.

当我启动Android模拟器并且第一次打开应用程序时,这不是必需的.知道如何自动发送位置无论如何?

android geolocation android-emulator google-geolocation ionic-framework

11
推荐指数
1
解决办法
324
查看次数

Angular 2:无法读取未定义的属性'unsubscribe'

我正在尝试创建ObservableTimer一个特定数字.我已经有了这样做的逻辑,但是当我尝试取消订阅时,我得到了一个"Cannot read property 'unsubscribe' of undefined"错误.这是我的代码

syncExpireTime() {
    let route = AppSettings.API_ENDPOINT + 'Account/ExpireTime'
    this.http.get(route, this.options).map(this.extractData).catch(this.handleError).subscribe(
        res => {this.expireTime = +res},
        error => console.log(error),
        () => this.timerSub = TimerObservable.create(0,1000)
            .takeWhile(x => x <= this.expireTime)
            .subscribe(x => x == this.expireTime ? this.logout() : console.log(x))
    )
}
Run Code Online (Sandbox Code Playgroud)

然后这是我的注销代码.我在注销时试图取消订阅到期时间

logout() {
    this.timerSub.unsubscribe()
    this.router.navigate(['./login'])
}
Run Code Online (Sandbox Code Playgroud)

observable rxjs angular

6
推荐指数
2
解决办法
2万
查看次数

Angular 2 打印组件

在纯 JavaScript 中,您可以通过获取元素 ID、将其放入新窗口并使用 window.print() 来打印元素。

做这样的事情的“Angular 2”方式是什么?我已经获得了我希望打印的组件的 ViewChild,但我不确定如何访问它的 html 并随后打印它,或者这是否是我应该做的。

angular

6
推荐指数
1
解决办法
1万
查看次数

无法从 web api 获取文件

我正在尝试通过 get 请求发送文件,但此代码不起作用。我正在使用 .NET Core 并使用 Postman 测试 API。

// POST api/values
[HttpGet]
public HttpResponseMessage Get(string filename)
{
    HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
    var stream = new FileStream($"Scans/{filename}.obj", FileMode.Open, FileAccess.Read);
    result.Content = new StreamContent(stream);
    result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
    return result;
}
Run Code Online (Sandbox Code Playgroud)

当我通过邮递员测试请求时,我得到的是这个而不是我的流:

{
"version": {
"major": 1,
"minor": 1,
"build": -1,
"revision": -1,
"majorRevision": -1,
"minorRevision": -1
},
"content": {
"headers": [
  {
    "key": "Content-Type",
    "value": [
      "application/octet-stream"
    ]
  },
  {
    "key": "Content-Length",
    "value": [
      "8785871"
    ]
  }
]
}, …
Run Code Online (Sandbox Code Playgroud)

c# postman asp.net-core asp.net-core-webapi

4
推荐指数
1
解决办法
1428
查看次数