-
Notifications
You must be signed in to change notification settings - Fork 252
fix(remove httpclientmodule): refactor to drop depedency on httpClien… #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
74aed57
fix(remove httpclientmodule): refactor to drop depedency on httpClien…
SanderElias d6039a7
feat(transferstate): refactor to use a global, instead of parsion on …
SanderElias e733fb7
improvement(transer-state.service): use index.html to prevent unneede…
SanderElias db135b2
fix(transferstate): make sure there are no emmisions of state _during…
SanderElias 02b64b3
improvement(transerstate): make sure state doesn't get emmitted durin…
SanderElias dbebe3c
fix(transferstate): move navigationDome to correct place
SanderElias a372da1
improvement(transferstateservice): don't emit state during navigation
SanderElias 67ddc40
feat(merge master): fix merge issue
SanderElias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| const {routeSplit, registerPlugin, httpGet} = require('../dist/scully'); | ||
|
|
||
| const newsSamplePlugin = async (route, config) => { | ||
| const {createPath} = routeSplit(route); | ||
| const list = await httpGet('http://localhost:4200/assets/news.json'); | ||
| const handledRoutes = []; | ||
| for (item of list) { | ||
| const blogData = await httpget(`http://localhost:4200/assets/news/${list.id}.json`); | ||
| handledRoutes.push({ | ||
| route: createPath(item.id, blogdata.slug), | ||
| title: blogData.title, | ||
| description: blogData.short, | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| registerPlugin('router', 'myBlog', newsSamplePlugin); | ||
|
|
||
| const config = { | ||
| '/news/:id/:slug': { | ||
| type: 'myBlog', | ||
| postRenderers: postRenderers, | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * | ||
| '/news/:id/:slug': { | ||
| type: 'json', | ||
| postRenderers: postRenderers, | ||
| id: { | ||
| url: 'http://localhost:4200/assets/news.json', | ||
| property: 'id', | ||
| }, | ||
| slug: { | ||
| url: 'http://localhost:4200/assets/news/${id}.json', | ||
| property: 'slug', | ||
| }, | ||
| }, | ||
|
|
||
| { | ||
| "id": 5, | ||
| "slug": "newsitem-5", | ||
| "title": "Newsitem #5", | ||
| "short": "Lorem ipsum dolor .." | ||
| } | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,8 @@ | ||
| import {HttpClient} from '@angular/common/http'; | ||
| import {ModuleWithProviders, NgModule} from '@angular/core'; | ||
| import {NgModule} from '@angular/core'; | ||
| import {ScullyContentComponent} from './scully-content/scully-content.component'; | ||
|
|
||
| @NgModule({ | ||
| declarations: [ScullyContentComponent], | ||
| exports: [ScullyContentComponent], | ||
| }) | ||
| export class ComponentsModule { | ||
| static forRoot(): ModuleWithProviders<ComponentsModule> { | ||
| return { | ||
| ngModule: ComponentsModule, | ||
| providers: [HttpClient], | ||
| }; | ||
| } | ||
| } | ||
| export class ComponentsModule {} |
16 changes: 3 additions & 13 deletions
16
projects/scullyio/ng-lib/src/lib/route-service/scully-routes.service.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 5 additions & 16 deletions
21
projects/scullyio/ng-lib/src/lib/scully-content/scully-content.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export function fetchHttp<T>(url: string, responseType: XMLHttpRequestResponseType = 'json'): Promise<T> { | ||
| return new Promise((resolve, reject) => { | ||
| const xhr = new XMLHttpRequest(); | ||
| xhr.responseType = responseType; | ||
| xhr.addEventListener('load', ev => resolve(xhr.response)); | ||
| xhr.addEventListener('error', (...err) => reject(err)); | ||
| xhr.open('get', url, true); | ||
| xhr.send(); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.