-
Notifications
You must be signed in to change notification settings - Fork 145
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
DeepLinkHandler is global, how can i call my service? #128
Comments
|
ohh, so it is basically sending an event signal from javascript to the listener somewhere inside my platform ready. |
Issue resolved, closing now. |
note, the name handleOpenUrl seems to be colliding with facebook4 plugin |
You might be using https://github.com/EddyVerbruggen/Custom-URL-scheme plugin. handleOpenUrl function name is irrelevant in this case since Branch handles branch and non-branch links. Just rename the function. |
Super thanks to @jstoup111 's solution. I modified his code and made it into general one and use 'sidemenu' template from ionic 1. See here https://gist.github.com/haxpor/644893a22f79bc910db37d79d36a2f00. |
This is the solution I have been using to integrate Branch's global DeepLinkHandler into Ionic/Angular. Global DeepLinkHandler into Angular
// must be a global function
function DeepLinkHandler(data) {
if (data) {
// access the angular Factory('DeepLink')
angular.element(document.querySelector('[ng-app]')).injector().get('DeepLink').set(data);
console.log('Data Link handler response: ' + JSON.stringify(data));
} else {
console.error('Data Link handler no data');
}
}
angular.module('starter.services', [])
.factory('DeepLink', function($window, $timeout) {
var data = {};
return {
get: function() {
return data;
},
set: function(json) {
// use the angular version of timeout
$timeout(function() {
// set the data
data = json;
// navigate example
$window.location = "#/tab/chats/3";
}, 0);
}
};
});
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope, DeepLink) {
$scope.content = {}
$scope.buttonPressed = function() {
// put branch data into a label that has ng-model content.data
$scope.content.data = JSON.stringify(DeepLink.get());
};
}) |
Hello,
We have a problem about DeepLinkHandler . Since we are forced to make it a global function, we do not know how to use our angular services that we want.
(already emailed brunch about it and didn't get a real answer)
Thanks,
Jonathan
The text was updated successfully, but these errors were encountered: