This module provides an abstraction of IonicDeeplink
plugin.
JavaScript code of IonicDeeplink is used as plain JS module instead
of the $cordovaDeeplinks
AngularJS service.
That's because it's not part of commonly used ngCordova project. It's defined in a drop-in replacement project named ionic-native.
Setting ionic.native
AngularJS module as a requirement may collide with projects using ngCordova because all
service names are the same.
This module requires the following Cordova plugins:
Provider $mfwiLinksProvider
offers a way of linking ui.router
states to deep links.
Method $mfwiLinksProvider.addRoute()
allows you
to specify a deep link URL associated to a state name, so the state is accessed automatically when a deep link match
is found.
Example
$mfwiLinksProvider // One to one .addRoute('/products', 'app.products') // Match parameters are used as `$stateParams` .addRoute('/products/:productId', 'app.products.detail');
There's a declarative way of deining links to ui.router states just by adding a deepLink
property to the state's data
object.
This way you can avoid using explicitly $mfwiLinksProvider
to add
deep links to your screen states.
You can define deep links in your state in different ways:
true
boolean value: the state URL is used as deep link route URLString
value: explicit deep link route URLFunction
or Array.<string|function()>
: the state URL is used as deep link and the injectable callback is set.object
value: the state URL is used as deep link and the object itself is used as route data.callback
property with an injectable callback definition.uiRouterParent
property the name of the state(s) to be loaded before the current one to ensure
a navigation flow.Example
$stateProvider .state({ name: 'settings', url: '/settings', data: { // deep link URL: /settings deepLink: true } }) .state({ name: 'settings.language', url: '/language', data: { // deep link URL: /customer/language deepLink: '/customer/language' } }) .state({ name: 'settings.section2', url: '/section2', data: { // deep link URL: /settings/section2 deepLink: ['$log', '$match', function ($log, $match) { $log.log('Match found', $match); }] } }) .state({ name: 'section3', url: '/section3', data: { // deep link URL: /section3 deepLink: function ($log, $match) { $log.log('Match found', $match); } } }) .state({ name: 'section4', url: '/section4', data: { // deep link URL: /section4 deepLink: { uiRouterParent: 'settings', param1: 'value1', param2: 'value2' } } }) .state({ name: 'section5', url: '/section5', data: { // deep link URL: /settings/section5 deepLink: { param1: 'value1', param2: 'value2', callback: function ($match) { } } } });