小编sha*_*ics的帖子

Angular:无法读取undefined的属性'name'

在我的angular 4应用程序中,每次我的侧边栏组件呈现时,我都会收到这个奇怪的错误.我的代码中没有任何属性"name".发现很难弄清楚错误被抛出的原因.以下是控制台错误日志.任何帮助深表感谢.

HTML代码:

<div class="sidebar" >
        <app-sidebar></app-sidebar>
        <div class="sidebar-background" style="background-image: url(assets/img/sidebar-1.jpg)"></div>
    </div>
Run Code Online (Sandbox Code Playgroud)

错误日志:

ERROR TypeError: Cannot read property 'name' of undefined
    at checkBindingNoChanges (core.js:9912)
    at checkNoChangesNodeInline (core.js:13961)
    at checkNoChangesNode (core.js:13935)
    at debugCheckNoChangesNode (core.js:14764)
    at debugCheckDirectivesFn (core.js:14666)
    at Object.eval [as updateDirectives] (AppComponent.html:2)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:14648)
    at checkNoChangesView (core.js:13773)
    at callViewAction (core.js:14126)
    at execComponentViewsAction (core.js:14078)
    at checkNoChangesView (core.js:13776)
    at callWithDebugContext (core.js:15049)
    at Object.debugCheckNoChangesView [as checkNoChangesView] (core.js:14593)
    at ViewRef_.webpackJsonp.../../../core/esm5/core.js.ViewRef_.checkNoChanges (core.js:11584)
    at core.js:5903
View_AppComponent_0 @ AppComponent.html:2
proxyClass @ compiler.js:14645
webpackJsonp.../../../core/esm5/core.js.DebugContext_.logError @ core.js:14989 …
Run Code Online (Sandbox Code Playgroud)

angular

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

标签 统计

angular ×1