nativescript-ng2-magic looks for html in wrong path

89 Views Asked by At

I have a problem with nativescript-ng2-magic. I have a web app, and now I am trying to build a mobile app by using nativescript-ng2-magic for sharing code.

In my starting component (app.component.*) (path: app/app/) I have included page-router-outlet to be redirected to the login page. For this, I have declared the path in app.routing.ts {path: "", redirectTo: "/login"}.

The files for the login page are under app/components/login. in login.routing I declared the path { path: "login", component: LoginComponent }. Then I am doing a RouterModule.forChild(loginRoutes);

The login component (same path as the login.routing.ts) looks like this:

@Component({
  selector: "login",
  templateUrl: "./login.component.html",
  styleUrls: ["./login.common.css"],
})
export class LoginComponent implements OnInit {
 ...
}

When I want to start the mobile app I got the error message:

Error: File /data/data/org.nativescript.nativescript/files/app/app/login.component.tns.html does not exist.

That's right. As I wrote above the file is under app/app/components/login. Why is nativscript-ng2-magic looking in the wrong path?

1

There are 1 best solutions below

3
On

Perhaps you should set the full path to the login.component.htmland login.common.css. For example

@Component({
  selector: "login",
  templateUrl: "components/loginlogin.component.html",
  styleUrls: ["components/loginlogin.common.css"],
})
export class LoginComponent implements OnInit {
 ...
}