我一直在尝试解决这个错误,但是没有找到任何成功的方法来克服这个错误:!
错误日志:
异常: Uncaught (承诺):Error: Error in ./FooterComponent类FooterComponent -内联模板:15:20由:!错误:错误在./FooterComponent类FooterComponent -内联模板:15:20引起:没有提供程序的TemplateRef! 未处理的承诺拒绝:./FooterComponent类FooterComponent中的错误-内联模板:15:20由:无提供程序TemplateRef!;区域:角;任务: Promise.then;值:
footer.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'sa-footer',
templateUrl: './footer.component.html'
})
export class FooterComponent implements OnInit {
constructor() {}
ngOnInit() {}
}footer.component.html
<div class="page-footer">
<div class="row">
<div class="col-xs-12 col-sm-6">
<span class="txt-color-white">myAPP © 2016</span>
</div>
<div class="col-xs-6 col-sm-6 text-right hidden-xs">
<div class="txt-color-white inline-block">
<i class="txt-color-blueLight hidden-mobile">Last account activity <i class="fa fa-clock-o"></i>
<strong>52 mins ago </strong> </i>
<div class="btn-group dropup" dropdown>
<button class="btn btn-xs dropdown-toggle bg-color-blue txt-color-white" dropdownToggle>
<i class="fa fa-link"></i> <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right text-left" dropdownMenu>
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Download Progress</p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-success" style="width: 50%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Server Load</p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-success" style="width: 20%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Memory Load <span class="text-danger">*critical*</span>
</p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-danger" style="width: 70%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<button class="btn btn-block btn-default">refresh</button>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>我试着做了以下工作:
ngIf、ngSwitch等指令的模板找到了答案/解决方案(例如,忘记了* )TemplateRef添加到providers。我得到的是:类型'{ selector: string;templateUrl: string;providers: type of TemplateRef[];}‘的参数不能分配给“Component”类型的参数。属性“提供者”的类型是不兼容的。键入‘Type not TemplateRef[]’不能指定键入'Provider[]‘。输入‘Type not’不能分配到输入'Provider‘。键入‘Type not’不能指定键入'FactoryProvider‘。属性'provide‘在'typeof TemplateRef’类型中缺失。
我将尝试看看如何将TemplateRef添加到应用程序的模块providers中。但我不知道这是不是解决办法。我希望在我继续研究的时候有人能拿出解决方案。
谢谢你!
发布于 2017-03-30 10:15:27
研究:但只为实际包含ngIf、ngSwitch等指令的模板找到了答案/解决方案(例如,忘记了* )
在这里缺少*:
<ul class="dropdown-menu pull-right text-left" dropdownMenu>应该是
<ul class="dropdown-menu pull-right text-left" *dropdownMenu>来自NG2-自举
https://stackoverflow.com/questions/43114306
复制相似问题