Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: NS 4.0 Integration #1250

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
vakrilov merged 17 commits into master from ns-40-first-phase
Mar 29, 2018
Merged

feat: NS 4.0 Integration #1250

vakrilov merged 17 commits into master from ns-40-first-phase
Mar 29, 2018

Conversation

@vakrilov
Copy link
Contributor

@vakrilov vakrilov commented Mar 22, 2018
edited
Loading

Bootstrap and Navigation

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.

Previous Behavior

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.

Limitations:

  • You cannot change the root view of the app (to RadSideDrawer for example). It is always the Frame created by the bootstrap.
  • You can have only one <page-router-outlet> as there is only one Frame.
  • You always have a Page view wrapping your components and you can always. Because the ActionBar is part of that Page you can always change it with the <ActionBar> component.

New Behavior

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.

Which means:

  • You can use any view for application root. Finally, you can have application-wide RadSideDrawer.

  • You have more flexibility over where to place the <page-router-outlet>, you can even have more than one for more advanced scenarios.

  • 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:

platformNativeScript({ createFrameOnBootstrap: true })
 .bootstrapModuleFactory(AppModuleNgFactory);
  • 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.

Working with Frames

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).

NathanWalker, abdulhaq-e, and lambourn reacted with thumbs up emoji triniwiz reacted with heart emoji
@ghost ghost assigned vakrilov Mar 22, 2018
@ghost ghost added the in progress label Mar 22, 2018
@ghost ghost assigned SvetoslavTsenov Mar 25, 2018
Copy link
Contributor

test

vakrilov and others added 14 commits March 25, 2018 16:27
Angular application is started with `application.run()` which means the the root view of the app will be the root view of the `AppComponent`.
Previous behavior: Anagular application was started with `application.start()` - this aways creates a root `Frame`. The platfrom bootstrap was always creating the inital `Page` and loading the `AppComponent` inside.
The `<page-router-outlet>` will create a Frame as a native element and will create a page for each component activated in it (including the inital page).
Add `tsc-w` script to plugin's `package.json` file.
Rename RootView class to AppHostView class.
Expose ngAppRoot property of AppHostView class.
Add modal-nested-test example.
Copy link
Contributor

test

Copy link
Contributor Author

test

Copy link
Contributor

test

2 similar comments
Copy link
Contributor

test

Copy link
Contributor

test

@vakrilov vakrilov changed the title (削除) [Do not merge]feat: NS 4.0 Integration (削除ここまで) (追記) feat: NS 4.0 Integration (追記ここまで) Mar 29, 2018
@vakrilov vakrilov merged commit 7bfddbb into master Mar 29, 2018
@ghost ghost removed the in progress label Mar 29, 2018
@vakrilov vakrilov deleted the ns-40-first-phase branch March 29, 2018 10:41
vakrilov pushed a commit that referenced this pull request Mar 29, 2018
feat: NS 4.0 Integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sis0k0 sis0k0 Awaiting requested review from sis0k0

@MartoYankov MartoYankov Awaiting requested review from MartoYankov

@vchimev vchimev Awaiting requested review from vchimev

1 more reviewer

@SvetoslavTsenov SvetoslavTsenov SvetoslavTsenov approved these changes

Reviewers whose approvals may not affect merge requirements

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /