|
| 1 | +<a name="5.3.0"></a> |
| 2 | +# [5.3.0](https://github.com/NativeScript/nativescript-angular/compare/5.2.0...v5.3.0) (2018-04-10) |
| 3 | + |
| 4 | +> This version requires NativeScript 4.0. |
| 5 | +
|
| 6 | +### Bug Fixes |
| 7 | + |
| 8 | +* **animations:** provide fake document object in both AoT and JiT mode ([#1164](https://github.com/NativeScript/nativescript-angular/issues/1164)) ([040e0e3](https://github.com/NativeScript/nativescript-angular/commit/040e0e3)), closes [#1163](https://github.com/NativeScript/nativescript-angular/issues/1163) |
| 9 | +* App crashes on restart in android ([#1261](https://github.com/NativeScript/nativescript-angular/issues/1261)) ([331b878](https://github.com/NativeScript/nativescript-angular/commit/331b878)) |
| 10 | + |
| 11 | + |
| 12 | +### Features |
| 13 | + |
| 14 | +* NS 4.0 Integration ([#1250](https://github.com/NativeScript/nativescript-angular/issues/1250)) ([f84fbdc](https://github.com/NativeScript/nativescript-angular/commit/f84fbdc)) |
| 15 | +* prevent core modules from getting loaded multiple times ([#1196](https://github.com/NativeScript/nativescript-angular/issues/1196)) ([010fed7](https://github.com/NativeScript/nativescript-angular/commit/010fed7)) |
| 16 | + |
| 17 | + |
| 18 | +### BREAKING CHANGES |
| 19 | + |
| 20 | +#### Importing `NativeScriptModule` and `NativeScriptAnimationsModule` in multiple ngModules is no longer allowed. |
| 21 | + |
| 22 | +To migrate: |
| 23 | + * in `AppModule`: |
| 24 | + * import `NativeScriptModule` |
| 25 | + * import`NativeScriptAnimationsModule` - only if you are planning to use Angular Animations |
| 26 | + * in the remaining modules: |
| 27 | + * remove `NativeScriptModule` imports and replace with `NativeScriptCommonModule` import |
| 28 | + * remove `NativeScriptAnimationsModule` imports |
| 29 | + |
| 30 | +BEFORE: |
| 31 | + |
| 32 | +app.module.ts: |
| 33 | +``` |
| 34 | +import { NativeScriptModule } from 'nativescript-angular/nativescript.module'; |
| 35 | +import { NativeScriptAnimationsModule } from 'nativescript-angular/animations'; |
| 36 | +... |
| 37 | +@NgModule({ |
| 38 | + imports: [ |
| 39 | + NativeScriptModule, |
| 40 | + NativeScriptAnimationsModule |
| 41 | + ], |
| 42 | +... |
| 43 | +}) |
| 44 | +``` |
| 45 | + |
| 46 | +another.module.ts: |
| 47 | +``` |
| 48 | +import { NativeScriptModule } from 'nativescript-angular/nativescript.module'; |
| 49 | +import { NativeScriptAnimationsModule } from 'nativescript-angular/animations'; |
| 50 | +... |
| 51 | +@NgModule({ |
| 52 | + imports: [ |
| 53 | + NativeScriptModule, |
| 54 | + NativeScriptAnimationsModule |
| 55 | + ], |
| 56 | +... |
| 57 | +}) |
| 58 | +``` |
| 59 | + |
| 60 | +AFTER: |
| 61 | + |
| 62 | +app.module.ts: |
| 63 | +``` |
| 64 | +import { NativeScriptModule } from 'nativescript-angular/nativescript.module'; |
| 65 | +import { NativeScriptAnimationsModule } from 'nativescript-angular/animations'; |
| 66 | +... |
| 67 | +@NgModule({ |
| 68 | + imports: [ |
| 69 | + NativeScriptModule, |
| 70 | + NativeScriptAnimationsModule |
| 71 | + ], |
| 72 | +... |
| 73 | +}) |
| 74 | +``` |
| 75 | + |
| 76 | +another.module.ts: |
| 77 | +``` |
| 78 | +import { NativeScriptCommonModule } from 'nativescript-angular/common'; |
| 79 | +... |
| 80 | +@NgModule({ |
| 81 | + imports: [ |
| 82 | + NativeScriptCommonModule |
| 83 | + ], |
| 84 | +... |
| 85 | +}) |
| 86 | +``` |
| 87 | + |
| 88 | +#### NativeScript 4.0 Compatible Bootstrap and Navigation |
| 89 | +NativeScript 4.0 allows you to put any view as the root (not only Frame) of the application. To support in angular projects we had to introduce some changes in how A{N}gular apps are bootstrapped. |
| 90 | + |
| 91 | +PREVIOUS BEHAVIOR |
| 92 | + |
| 93 | +Bootstrap creates a root `Frame` and initial `Page`. Then it bootstraps the angular application inside this page. Navigation with `<page-router-outlet>` will always navigate in the `Frame` created by the bootstrap. |
| 94 | + |
| 95 | +Limitations: |
| 96 | +- You cannot change the root view of the app (to `RadSideDrawer` for example). It is always the `Frame` created by the bootstrap. |
| 97 | +- You can have only one `<page-router-outlet>` as there is only one `Frame`. |
| 98 | +- You always have a `Page` view wrapping your components. Because the `ActionBar` is part of that `Page` you can always change it with the `<ActionBar>` component. |
| 99 | + |
| 100 | +NEW BEHAVIOR |
| 101 | + |
| 102 | +Bootstrap will **not** create root view by default. It will use the root view of your main application component as the root view of the application. The `<page-router-outlet>` component will create its own `Frame` and will use it for navigation. It will also wrap the components you navigate to in a `Page` and will navigate to it as it did before. |
| 103 | + |
| 104 | +Which means: |
| 105 | + |
| 106 | +- You can use any view for application root. Finally, you can have application-wide `RadSideDrawer`. |
| 107 | + |
| 108 | +- You have more flexibility over where to place the `<page-router-outlet>`, you can even have more than one for more advanced scenarios. |
| 109 | + |
| 110 | +- If you **don't use `<page-router-outlet>`** in your app you will not get the default `Page` and `Frame`, which means you will not be able to inject them in you components or show the `ActionBar`. There is special `createFrameOnBootstrap` option you can pass on bootstrap to make things as _before_: |
| 111 | +``` |
| 112 | +platformNativeScript({ createFrameOnBootstrap: true }) |
| 113 | + .bootstrapModuleFactory(AppModuleNgFactory); |
| 114 | +``` |
| 115 | + |
| 116 | +- If you **are using `<page-router-outlet>`** you probably don't have to do any changes. Bootstrap will not create `Frame` and `Page`, but the outlet will do that. It will also take care of providing `Page` and so the `ActionBar` should work as _before_. |
| 117 | + |
| 118 | + |
| 119 | +WORKING WITH FRAMES |
| 120 | + |
| 121 | +There might be multiple frames (if you have multiple `<page-router-outlet>`'s). Angular DI works with singletons, so it will always return one instance of `Frame`. We have introduced `FrameService` (still experimental) which has a `getFrame()` method. It will return the current frame (the one you have navigated last). |
| 122 | + |
| 123 | +#### Signature of `onAfterLivesync` changed |
| 124 | + |
| 125 | +The signature `onAfterLivesync` observable changed from: |
| 126 | +``` |
| 127 | +export const onAfterLivesync = new EventEmitter<NgModuleRef<any>>(); |
| 128 | +``` |
| 129 | +to: |
| 130 | +``` |
| 131 | +export const onAfterLivesync = new EventEmitter<{ moduleRef?: NgModuleRef<any>; error?: Error }>(); |
| 132 | +``` |
| 133 | + |
| 134 | + |
1 | 135 | <a name="5.2.0"></a>
|
2 | 136 | # [5.2.0](https://github.com/NativeScript/nativescript-angular/compare/5.0.0...5.2.0) (2018-01-17)
|
3 | 137 |
|
|
0 commit comments