NativeScript / sample-Groceries

:green_apple: :pineapple: :strawberry: A NativeScript-built iOS and Android app for managing grocery lists
Apache License 2.0
485 stars 345 forks source link

templateUrl, styleUrls cannot reference by filename on same directory #268

Closed sattha closed 7 years ago

sattha commented 7 years ago

Actually this...

@Component({ selector: "list", templateUrl: "pages/list/list.html", styleUrls: ["pages/list/list-common.css", "pages/list/list.css"], providers: [GroceryListService] })

Should be and Can be this...

@Component({ selector: "list", templateUrl: "list.html", styleUrls: ["list-common.css", "list.css"], providers: [GroceryListService] })

So IDE like PHPStorm can jump to file when I press command+b on Mac. This is the things that I always do in Angular project. Is it possible for NativeScript to understand the relative path ?

sis0k0 commented 7 years ago

Sure, add moduleId: module.id to the component's metadata :)

TLDR; The module id is used to keep track of where the component was located when resolving the relative paths to its template/stylesheet. You can read more about where the value of module.id comes from here: http://wiki.commonjs.org/wiki/Modules/1.1.

sattha commented 7 years ago

Thank you, for your feedback, it's work now.