【发布时间】:2019-02-02 17:03:01
【问题描述】:
我刚刚在angular meteor 开始新项目,根据这个:
https://angular-meteor.com/tutorials/whatsapp2/meteor/setup
我的浏览器在下面显示,这是 path 到文件所在的位置 html 内容:
但是,在浏览器中应该只有My App。 Meteor 不呈现 html 模板内容,而是呈现内容的路径。请给我建议。谢谢。
app.component.ts:
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import template from './app.html';
@Component({
selector: 'my-app',
template
})
export class MyApp {
constructor(platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
if (platform.is('cordova')) {
StatusBar.styleDefault();
Splashscreen.hide();
}
});
}
}
app.module.ts:
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { BrowserModule } from '@angular/platform-browser';
import { MyApp } from './app.component';
@NgModule({
declarations: [
MyApp
],
imports: [
IonicModule.forRoot(MyApp),
BrowserModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler }
]
})
export class AppModule {}
main.html:
<head>
<title>Ionic2-MeteorCLI-WhatsApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="theme-color" content="#4e8ef7">
</head>
<body>
<ion-app></ion-app>
</body>
tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"skipLibCheck": true,
"stripInternal": true,
"noImplicitAny": false,
"typeRoots": [
"node_modules/@types/"
],
"types": [
"meteor-typings",
"@types/underscore"
]
},
"include": [
"client/**/*.ts",
"server/**/*.ts",
"imports/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
编辑:
谢谢你的回答。编辑模板格式后=>我得到了新的错误。我的页面现在是空的(应该有文本“我的应用程序”)并且我在控制台中有新的错误:
ERROR RangeError: Maximum call stack size exceeded
at Object.resolveDep (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:40111)
at Injector_.get (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:39683)
at Object.resolveDep (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:40179)
at Injector_.get (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:39683)
at Object.resolveDep (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:40179)
at Injector_.get (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:39683)
at Object.resolveDep (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:40179)
at Injector_.get (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:39683)
at Object.resolveDep (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:40179)
at Injector_.get (modules.js?hash=3bc92748a65daa75c5e4de9e0dbe6210430d61f0:39683)
【问题讨论】:
-
我也遇到了这个问题。 @Urigo,您编辑了问题但没有回答? :-/
-
我还没解决。我对流星有点失望。我会很感激一些建议,如何解决它。谢谢
-
据我所知,由于包版本和兼容性差异,Urigo 的教程很糟糕。请注意,它已经有几年的历史了。另请注意,此堆栈中的大多数未解决问题都与本教程有关。如果我知道答案,我会贡献它们,但我不知道,而且我很难在这里找到其他迷失的灵魂。在这一点上,我正在考虑放弃一起使用 Meteor/Angular/Ionic 的想法,并尝试只在 Ionic 中构建我的应用程序的想法。仍在寻找完美的 JS 全栈。
标签: angular meteor render angular2-template angular-meteor