mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
chore(deeplinks): Updated Deeplinks docs
This commit is contained in:
parent
0660a3bc67
commit
6982a2d35f
@ -28,9 +28,35 @@ export interface DeeplinkMatch {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { IonicDeeplinks } from 'ionic-native';
|
||||
* import { Deeplinks } from 'ionic-native';
|
||||
*
|
||||
* Deeplinks.route({
|
||||
'/about-us': AboutPage,
|
||||
'/universal-links-test': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
}).subscribe((match) => {
|
||||
// match.$route - the route we matched, which is the matched entry from the arguments to route()
|
||||
// match.$args - the args passed in the link
|
||||
// match.$link - the full link data
|
||||
console.log('Successfully matched route', match);
|
||||
}, (nomatch) => {
|
||||
// nomatch.$link - the full link data
|
||||
console.error('Got a deeplink that didn\'t match', nomatch);
|
||||
});
|
||||
* ```
|
||||
*
|
||||
* Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
|
||||
* the actual navigation for you:
|
||||
*
|
||||
* ```typescript
|
||||
* Deeplinks.routeWithNavController(this.navController, {
|
||||
'/about-us': AboutPage,
|
||||
'/products/:productId': ProductPage
|
||||
});
|
||||
* ```
|
||||
*
|
||||
* See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
||||
* retrieve the `NavController` reference at runtime.
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'Deeplinks',
|
||||
@ -49,8 +75,8 @@ export class Deeplinks {
|
||||
* paths takes an object of the form { 'path': data }. If a deeplink
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
* @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
|
||||
* is rejected if a deeplink comes through that does not match a given path.
|
||||
* @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
@ -72,8 +98,8 @@ export class Deeplinks {
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
*
|
||||
* @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
|
||||
* is rejected if a deeplink comes through that does not match a given path.
|
||||
* @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
|
Loading…
Reference in New Issue
Block a user