2016-12-21 5 views
0

nativescript-ng2-magicに問題があります。私はWebアプリケーションを持っていますが、今はコードの共有にnativescript-ng2-magicを使用してモバイルアプリを構築しようとしています。nativescript-ng2-magicが間違ったパスでhtmlを探します

私の出発コンポーネント(app.component。*)(パス:app/app /)には、ログインページにリダイレクトされるページルータコンセントが含まれています。このため、私はapp.routing.tsのパスを宣言しました {path: "", redirectTo: "/login"}

ログインページのファイルは、app/components/loginにあります。 login.routingで私はパスを宣言しました { path: "login", component: LoginComponent }

:私は、エラーメッセージが表示されましたモバイルアプリを起動したい場合は

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

:それから私は、ログインコンポーネント(login.routing.tsと同じパス)は次のようになりますRouterModule.forChild(loginRoutes);

をしています

エラー:/data/data/org.nativescript.nativescript/files/app/app/app/login.component.tns.htmlファイルが存在しません。

そうです。上に書いたように、ファイルはapp/app/components/loginの下にあります。なぜnativscript-ng2-magicが間違った方向を向いているのでしょうか?

答えて

0

おそらく、完全パスをlogin.component.htmllogin.common.cssに設定する必要があります。 "ログイン"、templateUrl: "./components/login/login.component.html"、styleUrls:[」./components/login/login.common.css @Component({セレクタを用いて、実施例

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

用"]、})エクスポートクラスLoginComponent実装OnInit {...}モバイルアプリケーションは動作しますが、ファイルが見つからないためWebアプリケーションが動作しません – LeoGR

+0

レオはmodule.idと相対パスの例を使用してみてくださいhttps: //github.com/NativeScript/nativescript-sdk-examples-ng/blob/master/app/file-system/file-system-examples.component.ts#L13-L14 –

+0

簡単な例を教えてください。私は相対的な道を誤解していると思います。どのファイルに関連していますか? – LeoGR

関連する問題