Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 主机上下文无法以角度运行_Css_Angular_Ionic Framework_Ionic3_Angular2 Template - Fatal编程技术网

Css 主机上下文无法以角度运行

Css 主机上下文无法以角度运行,css,angular,ionic-framework,ionic3,angular2-template,Css,Angular,Ionic Framework,Ionic3,Angular2 Template,按钮背景为红色,但应为绿色 i、 e.主机上下文控制的条件样式未激活 子组件样式commander.scss 子组件模板commander.html 这其中很多都是基于这样的,所以它应该可以工作-我能看到的唯一真正的区别是,我有单独的模板和样式文件,并且我在Ionic中使用Angular 使用的软件包 在不同的环境中工作 这是stackblitz中的相同代码,它工作正常,按钮是绿色的,应该是: 我能看到的唯一区别是stackblitz使用Angular 4.1.3和Ionic 3.5.2?尽管我

按钮背景为红色,但应为绿色

i、 e.主机上下文控制的条件样式未激活

子组件样式commander.scss 子组件模板commander.html 这其中很多都是基于这样的,所以它应该可以工作-我能看到的唯一真正的区别是,我有单独的模板和样式文件,并且我在Ionic中使用Angular

使用的软件包 在不同的环境中工作 这是stackblitz中的相同代码,它工作正常,按钮是绿色的,应该是:


我能看到的唯一区别是stackblitz使用Angular 4.1.3和Ionic 3.5.2?尽管我不确定他们是如何设置环境的其余部分的。

是否如预期那样添加到DOM中了足够的空间?你能重现一下吗?你是在给
添加其他类吗?@GünterZöchbauer检查页面首页时,我可以确认它有以下类
class=“足够的空间离子页面显示页面”
——我说的是在我的环境中确认这一点,不是吗stackblitz@GünterZöchbauer参见stackblitzOk编辑的问题,因此,在StackBlitz中,您可以获得预期的行为。对不起,我不知道爱奥尼亚。
commander {
  button {
    background-color: red;
  }
  :host-context(.enough-space) .btn-theme {
    background-color: green;
  }
}
<button class="btn-theme" (click)="demand()">{{requestText}}</button>
...
<commander (command)="requestPage()" [requestText]="requestText"></commander>
@Component({
             selector: "page-front",
             templateUrl: "front.html",
             host: {'class': 'enough-space'}
           })
export class FrontPage {
...
}
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"ionic-angular": "3.9.0",