Error: SyntaxError: Unexpected token }
Error: SyntaxError: Unexpected token }
我正在尝试在 angular 中完成我的第一个项目。
我已经成功地完全打印了我的第一个 Hello world 程序。
我的index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
main.ts
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
bootstrap(AppComponent);
app.component.ts 文件
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
Hello {{details.firstName}}
`
})
export class AppComponent {
public details = {firstName : "gopi",lastName : "mohan",phoneNumber :"789456123",e-mail :"sadf@asljfdk.com"};
}
我已经按照 5 分钟快速入门进行操作了。
I am trying to print the first name of the object in my view part but i am getting the below error
Error: SyntaxError: Unexpected token }
尝试更改详细信息如下-
public details = {"firstName" : "gopi","lastName" : "mohan","phoneNumber" :"789456123","e-mail" :"sadf@asljfdk.com"};
看看这是否有帮助。
我正在尝试在 angular 中完成我的第一个项目。 我已经成功地完全打印了我的第一个 Hello world 程序。
我的index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
main.ts
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
bootstrap(AppComponent);
app.component.ts 文件
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
Hello {{details.firstName}}
`
})
export class AppComponent {
public details = {firstName : "gopi",lastName : "mohan",phoneNumber :"789456123",e-mail :"sadf@asljfdk.com"};
}
我已经按照 5 分钟快速入门进行操作了。
I am trying to print the first name of the object in my view part but i am getting the below error
Error: SyntaxError: Unexpected token }
尝试更改详细信息如下-
public details = {"firstName" : "gopi","lastName" : "mohan","phoneNumber" :"789456123","e-mail" :"sadf@asljfdk.com"};
看看这是否有帮助。