2016-06-10 28 views
0

我在2小時左右搜索了哪裏是我的錯誤。 這就是原因,我試着在這裏問我的問題。 我有這樣的錯誤:在我的應用程序中找不到angular2-cookies/core.js angular2 aspnet核心

「angular2餅乾/ core.js找不到」

我已經正確安裝angular2 cookie的使用NPM。

這裏是我的ServiceCookies:

import { Injectable } from '@angular/core'; 
import {CookieService, CookieOptionsArgs} from 'angular2-cookie/core'; 

@Injectable() 
export class CookiesService { 
    private option: CookieOptionsArgs; 

    constructor(private cookieService: CookieService) { 
    } 

    getCookie(key: string) { 
     return this.cookieService.get('cookieName'); 
    } 

    setCookie(key: string, value: string) { 
     var expiresDate = new Date(new Date().getTime() + 3600 * 1000); 
     this.option.expires = expiresDate.toDateString(); 
     // 10 ans pour le moment 
     this.cookieService.put(key, value, this.option.expires); 
    } 

    deleteCookie(key: string) { 
     this.cookieService.remove(key); 
    } 
} 

這裏是我的system.config.js其中i申報文件的路徑爲我的應用程序的運行。

/** 
* System configuration for Angular 2 samples 
* Adjust as necessary for your application needs. 
* Override at the last minute with global.filterSystemConfig (as plunkers do) 
*/ 
(function (global) { 

    // map tells the System loader where to look for things 
    var map = { 
     'app': 'app', // 'dist', 
     'rxjs': 'js/rxjs', 
     '@angular': 'js/@angular', 
     'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', 
     'angular2-cookie': 'node_modules/angular2-cookies' 
    }; 

    // packages tells the System loader how to load when no filename and/or no extension 
    var packages = { 
     'app': { main: 'boot.js', defaultExtension: 'js' }, 
     'rxjs': { defaultExtension: 'js' }, 
     'angular2-in-memory-web-api': { defaultExtension: 'js' }, 
       'angular2-cookie': { main: 'core.js', defaultExtension: 'js' } 
    }; 

    var packageNames = [ 
     '@angular/common', 
     '@angular/compiler', 
     '@angular/core', 
     '@angular/http', 
     '@angular/platform-browser', 
     '@angular/platform-browser-dynamic', 
     '@angular/router-deprecated', 
     '@angular/router', 
     '@angular/testing', 
     '@angular/upgrade' 
    ]; 

    var paths = { 
     'node_modules': 'node_modules', 
     'app': 'app/', 
     'app/*': 'app/*' 
    }; 

    // add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' } 
    packageNames.forEach(function (pkgName) { 
     packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }; 
    }); 

    var config = { 
     map: map, 
     packages: packages, 
     paths: paths 
    } 

    if (global.filterSystemConfig) { global.filterSystemConfig(config); } 

    System.config(config); 

})(this); 
+0

順便說一下,你知道ASP.NET Core不支持CORS但 – AngJobs

+0

我的問題是什麼鏈接? – Yvan

+0

你的意思是這個網頁的網址? – AngJobs

回答

1

一個錯字,我在你的system.config.js發現是應該

'angular2-cookie': 'node_modules/angular2-cookie' 

,而不是

'angular2-cookie': 'node_modules/angular2-cookies' 
在地圖{}

,不知道這將完全解決它。

相關問題