小编Pat*_*870的帖子

NgZone/Angular2/Ionic2 TypeError:无法读取未定义的属性'run'

我收到此错误TypeError:无法在Subscriber.js中读取未定义的属性'run':229 并且不知道为什么 - 在离子beta 10中这个代码工作正常...在11中没有.

import {Component, NgZone} from '@angular/core';
import {NavController} from 'ionic-angular';

declare var io;

@Component({
  templateUrl: 'build/pages/home/home.html'
})    
export class HomePage {
    static get parameters() {
        return [NgZone];
    }

    zone: any;
    chats: any;
    chatinp: any;
    socket: any;

constructor(public navCtrl: NavController, ngzone) {
    this.zone = ngzone;
    this.chats = [];
    this.chatinp ='';
    this.socket = io('http://localhost:3000');
    this.socket.on('message', (msg) => {
        this.zone.run(() => {
            this.chats.push(msg);
        });
    });
}

send(msg) {
    if(msg != ''){
        this.socket.emit('message', msg);
    }
    this.chatinp = '';
   } …
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework ionic2 ionic3 angular

10
推荐指数
1
解决办法
5265
查看次数

CSS:使用绝对位置变换比例

我的位置有点问题:绝对。让我解释。

在此处输入图片说明

悬停后我有这样的事情:

在此处输入图片说明

CSS代码:

.option {
    width: 50px;
    height: 50px;
    box-shadow: 1px 1px 1px 1px  #888;
}

.option:hover {
    transform: scale(2.25, 2.25);
    transition-duration: 0.01s;
    z-index:10;
    position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

将鼠标悬停在选项上后,我使用 transform: scale 来放大元素。但是,为了达到预期的效果,我必须添加position: absolute属性 - 这样,该选项在悬停后从 div 中消失。悬停工作正常,但其余 3 个选项向左 - 有什么办法可以解决这个问题吗?我想在悬停后仍显示 4 个选项,而不是剪切其余选项。

没有position:absolute元素就不会离开 div。

在此处输入图片说明

css css-position

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

Ionic2标签 - 如何更改所选标签的颜色?

与标题中一样,我想更改所选标签的背景颜色.我没有在文档中找到允许这个的任何变量.(http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/).怎么实现呢?

ionic2

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