question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NavController lifecycle events interfaces

See original GitHub issue

Short description of the problem:

NavController’s lifecycle events should have interfaces.

What behavior are you expecting?

Provide interfaces, which compel us to implement the corresponding methods like OnInit in Angular2, in order to benefit from typing and editor tooling.

Which Ionic Version? 1.x or 2.x 2.x

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
ysgkcommented, Aug 6, 2016

These interfaces assure that a component implements the hooks correctly; it eliminates the possibility of typos. Even if the methods should be renamed in the future, we could detect that change.

Besides, we could benefit from an IDE. Without these interfaces, we have to refer to the doc page to remember the name of the methods every time. But some IDEs are intelligent enough to suggest apposite candidates in an import sentence.

For example, we only have to type On in the curly brackets below to see the list of the lifecycle interfaces provided by Angular2: OnInit, OnChanges, and OnDestroy.

import { } from '@angular/core';

We only have to choose one of them and declare it in order to know which methods should be implemented if interfaces are provided.

I think it would be nice that ionic could provide such features. Thanks. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavController | Android Developers
Gets the ViewModelStoreOwner for a NavGraph. This can be passed to androidx.lifecycle.ViewModelProvider to retrieve a ViewModel that is scoped to the navigation ...
Read more >
NavController lifecycle events interfaces · Issue #7512 - GitHub
Short description of the problem: NavController's lifecycle events should have interfaces. What behavior are you expecting?
Read more >
UINavigationController | Apple Developer Documentation
A container view controller that defines a stack-based scheme for navigating hierarchical content.
Read more >
NavController.java - android Git repositories
NavController manages app navigation within a {@link NavHost}. ... handleLifecycleEvent(event); ... public interface OnDestinationChangedListener {.
Read more >
Navigating Lifecycle Events! - Ionic Blog
In Ionic 2, any view added or removed from a NavController emits certain events. You can take advantage of those events to instantiate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found