小编Ast*_*ten的帖子

位于0位置Angular2的JSON中的SyntaxError意外标记u

我试图用一些虚拟数据制作服务器.

这是我的System.js配置(因为我有一个略有不同的路由,这似乎工作到现在为止)

System.config({

            // baseURL to node_modules
            baseURL: '/plugins/dashboard/assets/@@version@@/node_modules',
            defaultJSExtensions: true
        });
        System.import('/plugins/dashboard/assets/@@version@@/app/main')
                .then(null, console.error.bind(console));
Run Code Online (Sandbox Code Playgroud)

这是我的服务:

import {Injectable}     from 'angular2/core';
import {Http, Response} from 'angular2/http';
//import {Observable }     from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';

import {newsLetter} from "../objects/newsLetter";


@Injectable()

export class newsLetterService {
constructor (private http: Http) {}

//Need to change this URL
private _myNewsLetterUrl = "http://epub-core.dev.prisma-it.com:8888/plugins/dashboard/assets/@@version@@/app/data/newsLetter.json";  // URL to web api

getNewsLetter () {
    console.log(this._myNewsLetterUrl);
    console.log(this.http.get(this._myNewsLetterUrl));
    return this.http.get(this._myNewsLetterUrl)
        .map(res => <newsLetter[]> res.json().data)
        // eyeball objects as json objects in …
Run Code Online (Sandbox Code Playgroud)

javascript json angularjs angular

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

angular ×1

angularjs ×1

javascript ×1

json ×1