Closed LeoLazGR closed 7 years ago
Hi, @LeoLazGR ,
Try this:
@Component({
selector: "login",
moduleId: module.id,
templateUrl: "./login.component.html",
styleUrls: ["./login.common.css"],
})
Hi @LeoLazGR,
The module doesn't take in consideration subfolders since it takes the urls and add ./app/
in front of it and change the extension to *.tns.*
.
@NathanWalker I updated the module nativescript-ng2-cli-magic to make it work with subfolder, i used the file-system
module from tns-core-modules
of NativeScript. It only works with one level of subfolder for now, I will update it asap to make it work for any level of subfolders.
I also changed the way of testing the module but I'm done yet, unit tests coming soon :)
I will give you a shoutout when it's done on the considered commit.
Excellent thanks for the help - been very busy so any assistance is greatly appreciated!
This project has moved here with updates to work with latest Angular-cli, please provide further improvements to new repo: https://github.com/wwwalkerrun/nativescript-ngx-magic
@NathanWalker great! packagedev.json is a big help, I will make a PR for the subfolders issue :)
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 { ... }
The web-app works fine. 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?
If I am using
@Component({ selector: "login", templateUrl: "./components/login/login.component.html", styleUrls: ["./components/login/login.common.css"], }) export class LoginComponent implements OnInit { ... }
the mobile app works, but then the Web-App doesn't work any more because the files are not found.