Skip to content

TypeError: linkParams.reduce is not a function #6653

@anyatran

Description

@anyatran

I'm trying to create a route for my app and this error keeps showing up. Here's my app.js file:

(function(app) {
  app.AppComponent = ng.core.Component({
      selector: 'my-app',
      template:
      '<nav> <ul> <li> <a [routerLink]="[\'/Display\']"> Display </a> </li> </ul> </nav>]<router-outlet></router-outlet>',
      directives: [ng.router.ROUTER_DIRECTIVES, ng.router.RouterLink, ng.router.RouterOutlet]
    })
    .Class({
      constructor: [ng.router.Router, function(router) {
        this.router = router;
      }]
    });
  console.log(app);
  console.log(ng.router)

  app.AppComponent = ng.router.RouteConfig([
    {path: '/', redirectTo: '/display'},
    {path: '/display', component: app.DisplayComponent, as: 'Display'}
  ])(app.AppComponent);
})(window.app || (window.app = {}));

display.component.js:

(function(app) {
  app.DisplayComponent = ng.core
    .Component({
      selector: 'display',
      //directives:[ng.router.ROUTER_DIRECTIVES],
      templateUrl: '/static/app/display/display.component.html'
    })
    .Class({
      constructor: function() {
        this.model = new app.Display("Baylee", "1/21/2017");
      }
    });
})(window.app || (window.app = {}));

boot.js:

(function(app) {
  document.addEventListener('DOMContentLoaded', function() {
    ng.platform.browser.bootstrap(app.AppComponent,
      [ng.router.ROUTER_PROVIDERS, ng.core.provide(ng.router.LocationStrategy, {useClass: ng.router.HashLocationStrategy})]);
  });
})(window.app || (window.app = {}));

and index.html (ran with Django):

{% block content %}
    <div ng-app="encompass">
        <div ng-view></div>
    </div>
    <my-app>Loading...</my-app>
{% endblock content %}

Also I'm currently running Angular 1.4 and Angular 2 in the same page. Can that cause an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions