我想在由同一个控制器的不同实例控制的页面上显示两个元素,但是我需要注册一些独特的外部信息(一个"操纵杆"获得一个识别属性集,如"player = one"而另一个获得"玩家=两个").我不确定最好的方法是将其拉下来
这是我要完成的一个通用示例:
<!-- These need to have different configurations -->
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="JoystickCtrl">...</div>
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="JoystickCtrl">...</div>
Run Code Online (Sandbox Code Playgroud)
我是不是该:
使用指令?
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="JoystickCtrl" player="one">...</div>
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="JoystickCtrl" player="two">...</div>
Run Code Online (Sandbox Code Playgroud)
使用$ injector?(fyi - 这可能是一个不正确的实现)
<div ng-controller="DualJoyCtrl">
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="joyOne" player="one">...</div>
<div ng-include src="'joystick/joy.tpl.html'"
ng-controller="joyTwo" player="two">...</div>
</div>
-----
.controller('DualJoyCtrl', function ($injector, JoystickCtrl, $scope, $rootScope) {
$scope.joyOne = $injector.instantiate(JoystickCtrl, {$scope: $rootScope.$new(), player:"one"});
$scope.joyTwo = $injector.instantiate(JoystickCtrl, {$scope: $rootScope.$new(), player:"two"});
});
Run Code Online (Sandbox Code Playgroud)
或者......不这样做?
我意识到这与另一个看似无关的堆栈帖子类似:
根据端口9222上的调试面板,我有一个接收器应用程序(来自cast-ios-sample的库存版本)正确地从我列入白名单的URI下载.但是,控制台很快就会从google的托管的cast_receiver.js中吐出这些行. (在receiver.html文件中引用)
[ 0.162s] [goog.net.WebSocket] An error occurred: undefined
[ 0.172s] [cast.receiver.ChannelOverWebSocket] Dispatch ERROR event to ws://localhost:8008/system/control
[ 0.177s] [cast.receiver.Channel] Dispatch ERROR event to ws://localhost:8008/system/control
[ 0.182s] [cast.receiver.Platform] Platform channel has an error: ws://localhost:8008/system/control
Run Code Online (Sandbox Code Playgroud)
然后在一系列这些错误之后(可能是在重试循环中):
[ 8.335s] [cast.receiver.Platform] This device doesn't support the platform API.
Run Code Online (Sandbox Code Playgroud)
如果我尝试手动建立与ws:// localhost:8008/system/control的WebSocket连接,我只是得到一个未定义的响应.
有什么东西我不见了吗?
我有下表:
CREATE TABLE group_members(id integer primary key AUTOINCREMENT, group_id integer, member_id integer, FOREIGN KEY (member_id) REFERENCES users(id));
Run Code Online (Sandbox Code Playgroud)
我试图通过从表中group_members选择 的值,然后传入 的值来将记录插入到表中。group_idusermember_id
insert into group_members (group_id, member_id)
values (select id from users where code ='12345' and location='multiple', 281);
Run Code Online (Sandbox Code Playgroud)
其中 281 是我要传入的会员 ID。
但我收到以下错误消息:
错误:“选择”附近:语法错误
你能为我指出正确的方向吗?