小编Coo*_*per的帖子

Runnable或Executor服务

哪个更容易,更适合用于在另一个线程中运行,特别是使程序等待结果但不锁定ui.

可能有一种方法比这两种方法都要好,但我不知道它们.

谢谢 :)

java multithreading executorservice runnable

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

Angular js $ scope错误

我试图使用种子应用程序使用angular.js站起来.

当浏览器执行我的控制器时,我收到以下错误:

TypeError: Cannot set property 'players' of undefined
at new bankC (http://localhost:8888/monopoly/js/controllers.js:18:20)
at invoke (http://localhost:8888/monopoly/lib/angular/angular.js:2795:28)
at Object.instantiate (http://localhost:8888/monopoly/lib/angular/angular.js:2805:23)
at http://localhost:8888/monopoly/lib/angular/angular.js:4620:24
at update (http://localhost:8888/monopoly/lib/angular/angular.js:13692:26)
at http://localhost:8888/monopoly/lib/angular/angular.js:8002:24
at Array.forEach (native)
at forEach (http://localhost:8888/monopoly/lib/angular/angular.js:110:11)
at Object.Scope.$broadcast (http://localhost:8888/monopoly/lib/angular/angular.js:8000:11)
at http://localhost:8888/monopoly/lib/angular/angular.js:7185:26 
Run Code Online (Sandbox Code Playgroud)

这是控制器代码,它是controller.js文件

function bankC($scope) {
  $scope.players = [
      {
        id: 0,
        name: "Playe1",
        balance: 1500
      },
      {
        id: 1,
        name: "Player2",
        balance: 1500
      },
      {
        id: 2,
        name: "Player 3",
        balance: 1500
      }
  ];
}
bankC.$inject = [];
Run Code Online (Sandbox Code Playgroud)

谢谢

编辑:

它在角度js上注册,在某个"页面"上使用

angular.module('myApp', ['myApp.filters', 'myApp.services', …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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