我有一个导入Http的服务,当我在我的应用程序中使用它时会抛出错误." 没有Http的提供者!g injectionError时出错 ".我懒得加载应用程序.提供者也是通过cli" ionic g provider ..." 生成的
投诉service.ts
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class ComplaintService {
private complaints: {subject: string, description: string}[] = [];
constructor(public http: Http) {
this.http = http;
this.complaints = null;
console.log('Hello ComplaintService Provider');
}
addComplaints(complaint: {subject: string, description: string}) {
this.complaints.push(complaint);
}
getComplaints() {
return this.complaints.slice();
}
}
Run Code Online (Sandbox Code Playgroud)
投诉form.ts
import { Component } from '@angular/core';
import {Validators, FormBuilder, FormGroup } from '@angular/forms'; …Run Code Online (Sandbox Code Playgroud) 我需要知道如何相应地向左,右和向上(顶部)运动添加此精灵图像的第2行,第3行,第4行.
下面的代码是底部移动,作为精灵的第一行,我能够移动它.
如果我水平创建一个长精灵,我可以实现它,还有其他方法吗?
请帮我弄清楚如何包括第二排.
精灵图片(用户/播放器):
function preload(){
myGame.load.spritesheet('user', 'user4.png', 95, 158, 12);
}
var player;
function create(){
player = myGame.add.sprite(500, 100, 'user');
myGame.physics.arcade.enable(player);
player.animations.add('bottom', [0,1,2,3,4,5,6,7,8,9,10,11], 12, true, true);
}
function update(){
if (cursors.left.isDown) {
// Move to the left
player.body.velocity.x = -150;
player.animations.play('left');
}
else if (cursors.right.isDown)
{
// Move to the right
player.body.velocity.x = 150;
player.animations.play('right');
}
else if (cursors.up.isDown)
{
// Move to the right
player.body.velocity.y = -50;
player.animations.play('top');
}
else if (cursors.down.isDown)
{
// Move to …Run Code Online (Sandbox Code Playgroud) 我创建了一个像这样的 Konva 图像
var imageObj = new Image();
imageObj.onload = function() {
var image = new Konva.Image({
x: 200,
y: 50,
image: imageObj,
width: 100,
height: 100
});
};
imageObj.src = '/path/to/image.jpg'
Run Code Online (Sandbox Code Playgroud)
现在我需要知道如何更新创建的 Konva.Image 对象的图像 src/url。
您可以在此处找到文档:https : //konvajs.github.io/api/Konva.Image.html