相关疑难解决方法(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万
查看次数

标签 统计

angular ×1