小编And*_*ata的帖子

es6从同一个类中调用类方法

我试图在我的类中调用一个类方法形成一个邻近的方法,如下面的例子所示.

import blah from './blaha';

export default class myclass{
  constructor(con) {
    this.config = con;
  }

  async meth1(paramA) {
    //do_stuff...
  }

    meth2(paramB) {
     //attempt to call meth1()
  }

}
Run Code Online (Sandbox Code Playgroud)

我想使用es6类样式从一个不同的方法中调用一个方法.

javascript oop node.js ecmascript-6

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

Rxjs观察对象更新和更改

我目前正在尝试观察给定对象的任何更改,包括它的所有元素.

以下代码仅在对象[x]更新时触发,但如果单独更新对象[x]的元素(如object [x] [y])则不会触发

<script>
  var elem = document.getElementById("test1");

var log = function(x) {
    elem.innerHTML += x + "<br/><br/><br/>";
};

var a = [{a:1,b:2},
         {a:2,b:5}
       ];


var source = Rx.Observable
.ofObjectChanges(a)
.map(function(x) {
    return JSON.stringify(x);
});


var subscription = source.subscribe(
    function (x) {log(x);},
    function (err) {log(err);},
    function () {log('Completed');}
);

a[0] = a[1];
</script>
Run Code Online (Sandbox Code Playgroud)

此代码运行并正确触发.

然而.如果我改为这个

a[0]['a'] = 3;
Run Code Online (Sandbox Code Playgroud)

然后什么都没发生

编辑

一个更好的方法来表达这一点,我如何观察一组对象的变化?

javascript frp rxjs

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

简单更新后帆无法升起

我有一台在 aws 弹性 beantalk 上运行的服务器。已经很不错了。但是今天在应用更新时(与所使用的模块的配置或版本控制完全无关),这只是在网络应用程序中的某些文本中添加几个单词(字面意思是“狗”这个词)。该应用程序因 502 nginx 网关错误而开始崩溃。我认为这是因为该应用程序没有吸引力。我去了并恢复了更改(虽然我认为我不必这样做)。并且问题仍然存在。

我尝试提升/启动风帆应用程序时的输出如下。

    Failed to load helper `web/auth/validate-user-password` as a machine!
A hook (`helpers`) failed to load!
Failed to lift app: ImplementationError: Sorry, could not interpret "web/auth/validate-user-password" because its underlying implementation has a problem:
------------------------------------------------------
• The `cacheable` property is no longer supported.  (Please use `sideEffects: 'cacheable' instead.)
------------------------------------------------------

If you are the maintainer of "web/auth/validate-user-password", then you can change its implementation to solve the problem above.  Otherwise, please file a bug report with …
Run Code Online (Sandbox Code Playgroud)

javascript nginx amazon-web-services node.js sails.js

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

laravel 刀片显示大括号

这是我的控制器代码:

public function getIndex()
{

    \Eloquent::unguard();

     $users = \DB::table('users')->get();;

     return \View::make('index')->with('users', $users);

}
Run Code Online (Sandbox Code Playgroud)

所以没什么好看的。

在我看来,我正在显示用户表中的数据:

@foreach ($users as $user) {
    {{$user->email}}
}      
@endforeach
Run Code Online (Sandbox Code Playgroud)

但似乎我的所有输出都{}围绕着每次迭代,如下所示:

{ 约翰 } { andrewmata361@gmail.com }

我不确定发生了什么以及为什么这些括号出现在我的所有输出中或如何摆脱它们。

php object laravel blade

2
推荐指数
1
解决办法
1883
查看次数