Comments (5)
In a way, I got the project rolling.
I changed the public folder systemjs.config.js
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': '/assets/'
},
// map tells the System loader where to look for things
map: {
// our application is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'angular2-token.model': 'npm:angular2-token/lib/angular2-token.model.js',
'angular2-token.service': 'npm:angular2-token/lib/angular2-token.service.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
app.module.ts from the public / app folder
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HeroDetailComponent } from './hero-detail.component';
import { HeroesComponent } from './heroes.component';
import { DashboardComponent } from './dashboard.component';
import { HeroSearchComponent } from './hero-search.component';
import { HeroService } from './hero.service';
import './rxjs-extensions';
import { Angular2TokenService } from 'angular2-token.service';
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule
],
declarations: [
AppComponent,
HeroDetailComponent,
HeroesComponent,
DashboardComponent,
HeroSearchComponent
],
providers: [ HeroService, Angular2TokenService ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
app.components.ts from the public / app folder
import { Component } from '@angular/core';
import { Angular2TokenService } from 'angular2-token.service';
@Component({
moduleId: module.id,
selector: 'my-app',
template: `
<h1>{{title}}</h1>
<nav>
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
</nav>
<router-outlet></router-outlet>
`,
styleUrls: ['app.component.css'],
})
export class AppComponent {
title = 'Tour of Heroes';
constructor(private _tokenService: Angular2TokenService) {
this._tokenService.init();
console.log('logged '+this._tokenService.userSignedIn());
}
}
I just do not know if this is the best way ...
Complete Code
branch: authentication
That's the best way?
from angular-token.
Hey @tiagobsbraga thanks for your detailed explanation.
After even angular-cli switched to webpack I did not do tests with SystemJS anymore. But seems like quite a lot of people try to make it work with the angular2 tutorial. Maybe I should add webpack as a requirement to the README until this I have the time to get this fixed.
Suggestions?
from angular-token.
So... I guess that we can try, do not you think?
I was not too keen on new things for the web, my focus today is more on developing mobile devices natively.
from angular-token.
I have the same error with https://github.com/mgechev/angular-seed and angular2-token. Could you give me a solution please?.
I'm trying do the following:
File
https://github.com/mgechev/angular-seed/blob/master/tools/config/project.config.ts
Changes
// Add packages (e.g. angular2-token)
let additionalPackages: ExtendPackages[] = [
{
name: 'angular2-token.service',
// Path to the package's bundle
path: 'node_modules/angular2-token/lib/angular2-token.service.js'
}
];
this.addPackagesBundles(additionalPackages);
File
https://github.com/mgechev/angular-seed/blob/master/src/client/app/app.component.ts
Changes
import { Angular2TokenService } from 'angular2-token.service';
console.log(Angular2TokenService);
And also have the same error:
Error: (SystemJS) Unexpected token <
from angular-token.
Should be fixed in the latest build. Please reopen if problem still persists.
from angular-token.
Related Issues (20)
- `currentUserData` is not updated after `registerAccount()` HOT 2
- Omniauth from electron app HOT 1
- Create a observable with the logic of userSignedIn() method HOT 2
- Guarding routes with currentUserData Not working after Refresh or Force link. HOT 2
- `signOutFailedValidate` option not working
- How can we add new header key value in http request
- HttpInterceptor Tokens Leak on CORS requests and break CORS. HOT 1
- Error in angular-token.model.d.ts
- Trying to contribute, how do you build a linkable lib? HOT 1
- Oauth callback window won't close after successful login HOT 1
- Auth data not saved when using oAuth HOT 1
- Compatibility With Angular 9 HOT 16
- Email and Password Can't be blank HOT 1
- User is being signed out after page reload
- additionalData not working HOT 1
- signOut() not working on Chrome and Firefox HOT 1
- Compatibility with Angular 11
- UserSignedIn Returns '401 Unauthorized'
- How to install the library having angular 14 HOT 3
- Add Angular 16 support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-token.