Problem trying to inject ViewSlot

Trying to inject ViewSlot into a skeleton based esnext project, the following error shows up in the browser. I have just created a simple project with the CLI based on systemjs and I see the same thing.

vendor-bundle.js:1398 Unhandled rejection Error: Error invoking ViewSlot. Check the inner error for details.

Inner Error:
Message: Cannot set property ‘viewSlot’ of undefined``

from a modified CLI generated app, this reproduces the same problem I see in the real app,

import { BoundViewFactory, ViewSlot, customAttribute, templateController, inject } from 'aurelia-framework';


export class App {
    constructor(viewSlot) {
        this.message = 'Hello World!';

        this.viewSlot = viewSlot;


you dont inject ViewSlot, use it like a class
maybe not the best sample but might help u :slight_smile:

Thanks for the reply, your sample helps :slightly_smiling_face:

A bit confused though as I see this from the cheat sheet on this site and many other samples that seem to inject ViewSlot. Maybe some design changes have occurred?

import {BoundViewFactory, ViewSlot, customAttribute, templateController, inject} from 'aurelia-framework';

@inject(BoundViewFactory, ViewSlot)
export class NaiveIf {
  constructor(viewFactory, viewSlot) {
    this.viewFactory = viewFactory;
    this.viewSlot = viewSlot;

  valueChanged(newValue) {
    if (newValue) {
      let view = this.viewFactory.create();
    } else {

dont think so :slight_smile: