ngx-quicklink
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -17,3 +17,3 @@ import { ElementRef, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<LinkDirective, [null, null, { optional: true; }, { optional: true; }]>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkDirective, "[routerLink]", never, { "routerLink": "routerLink"; }, {}, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkDirective, "[routerLink]", never, { "routerLink": "routerLink"; }, {}, never, never, true, never>; | ||
} |
@@ -0,7 +1,19 @@ | ||
import { ObservableLinkHandler, PreloadLinkHandler } from './link-handler.service'; | ||
import { PrefetchRegistry } from './prefetch-registry.service'; | ||
import { QuicklinkStrategy } from './quicklink-strategy.service'; | ||
import * as i0 from "@angular/core"; | ||
import * as i1 from "./link.directive"; | ||
export declare const quicklinkProviders: (typeof PrefetchRegistry | typeof QuicklinkStrategy | { | ||
provide: import("@angular/core").InjectionToken<unknown>; | ||
useClass: typeof ObservableLinkHandler; | ||
multi: boolean; | ||
} | { | ||
provide: import("@angular/core").InjectionToken<unknown>; | ||
useClass: typeof PreloadLinkHandler; | ||
multi: boolean; | ||
})[]; | ||
export declare class QuicklinkModule { | ||
static ɵfac: i0.ɵɵFactoryDeclaration<QuicklinkModule, never>; | ||
static ɵmod: i0.ɵɵNgModuleDeclaration<QuicklinkModule, [typeof i1.LinkDirective], never, [typeof i1.LinkDirective]>; | ||
static ɵmod: i0.ɵɵNgModuleDeclaration<QuicklinkModule, never, [typeof i1.LinkDirective], [typeof i1.LinkDirective]>; | ||
static ɵinj: i0.ɵɵInjectorDeclaration<QuicklinkModule>; | ||
} |
{ | ||
"name": "ngx-quicklink", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/common": "^15.0.0", |
export { QuicklinkModule } from './lib/quicklink.module'; | ||
export { LinkDirective as ɵɵLinkDirective } from './lib/link.directive'; | ||
export { LinkDirective as QuicklinkDirective } from './lib/link.directive'; | ||
export { QuicklinkStrategy } from './lib/quicklink-strategy.service'; |
@@ -63,2 +63,36 @@ <p align="center"> | ||
## Standalone components | ||
You can find example [here](https://github.com/mgechev/ngx-quicklink/tree/master/projects/standalone-app). | ||
To use the `ngx-quicklink` directive with standalone components in your `main.ts` add: | ||
```ts | ||
bootstrapApplication(AppComponent, { | ||
providers: [ | ||
quicklinkProviders, | ||
provideRouter([...], | ||
withPreloading(QuicklinkStrategy) | ||
), | ||
], | ||
}); | ||
``` | ||
Make sure you import the `QuicklinkDirective` in all your standalone components that use preloading: | ||
```ts | ||
import { Component } from '@angular/core'; | ||
import { RouterLink } from '@angular/router'; | ||
import { QuicklinkDirective } from 'ngx-quicklink'; | ||
@Component({ | ||
standalone: true, | ||
imports: [RouterLink, QuicklinkDirective], | ||
template: ` | ||
<a routerLink="/about">About</a> | ||
`, | ||
}) | ||
export default class HomeComponent {} | ||
``` | ||
**Note that to make the module available in lazy-loaded modules as well you need to import it in a shared module and export it.** Look at [this commit](https://github.com/mgechev/angular-realworld-example-app-qucklink/commit/33ea101c7d84bb5ca086f107148bbc958659f83f) to see how `ngx-quicklink` is integrated in the [angular-realworld-example-app](https://github.com/gothinkster/angular-realworld-example-app). | ||
@@ -65,0 +99,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
134302
161
1105