相关疑难解决方法(0)

Angular2异常:无法绑定到'routerLink',因为它不是已知的本机属性

显然,Angular2的测试版比新版更新,因此没有太多的信息,但我正在尝试做我认为是一些相当基本的路由.

使用https://angular.io网站上的快速入门代码和其他代码片段进行黑客攻击导致了以下文件结构:

angular-testapp/
    app/
        app.component.ts
        boot.ts
        routing-test.component.ts
    index.html
Run Code Online (Sandbox Code Playgroud)

文件填充如下:

的index.html

<html>

  <head>
    <base href="/">
    <title>Angular 2 QuickStart</title>
    <link href="../css/bootstrap.css" rel="stylesheet">

    <!-- 1. Load libraries -->
    <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>
    <script src="node_modules/rxjs/bundles/Rx.js"></script>
    <script src="node_modules/angular2/bundles/angular2.dev.js"></script>
    <script src="node_modules/angular2/bundles/router.dev.js"></script>

    <!-- 2. Configure SystemJS -->
    <script>
      System.config({
        packages: {        
          app: {
            format: 'register',
            defaultExtension: 'js'
          }
        }
      });
      System.import('app/boot')
            .then(null, console.error.bind(console));
    </script>

  </head>

  <!-- 3. Display the application -->
  <body>
    <my-app>Loading...</my-app>
  </body>

</html>
Run Code Online (Sandbox Code Playgroud)

boot.ts

import {bootstrap}    from 'angular2/platform/browser'
import {ROUTER_PROVIDERS} from 'angular2/router';

import …
Run Code Online (Sandbox Code Playgroud)

angular

266
推荐指数
8
解决办法
18万
查看次数

获取无法绑定到'routerLink',因为它不是'a'的已知属性.尽管引用了路由器moudule,但仍然出错

我在angular 4应用程序中实现基本路由,并在浏览器上加载应用程序时出现以下错误.我在approuting.module中定义了路由,也引用了Ngmodule中的路由器模块以及approuting.module.不确定是什么问题

Can't bind to 'routerLink' since it isn't a known property of 'a'.

Can't bind to 'routerLink' since it isn't a known property of 'a'. ("ew" [hidden]="!dataItem.isVisibleView">
                                                        <a [ERROR ->][routerLink]="['/view', dataItem.movieId, 'responses']" routerLinkActive="active"><i class="fa fa-fil"): ng:///MovieModule/MovieComponent.html@85:59
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("it" [hidden]="!dataItem.isVisibleEdit">
                                                        <a [ERROR ->][routerLink]="['edit', dataItem.movieId]" routerLinkActive="active"><i class="fa fa-pencil" aria-hidd"): ng:///MovieModule/MovieComponent.html@92:59
Run Code Online (Sandbox Code Playgroud)

以下是我的申请的源代码

movie.component.html中的kendo网格片段

  </kendo-grid-column>
                                             <kendo-grid-column title="View" headerClass="kendoGridHeader" class="kendoGridControlCell">
                                                <ng-template kendoGridCellTemplate let-dataItem>
                                                    <span data-title="View" [hidden]="!dataItem.isVisibleView">
                                                        <a [routerLink]="['/view', dataItem.movieId, 'responses']" routerLinkActive="active"><i class="fa fa-file-text" …
Run Code Online (Sandbox Code Playgroud)

kendo-grid angular2-routing kendo-ui-angular2 angular angular4-router

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