javascript - Enabling ng-click to open a link in browser window -
i have ng-click producing valid url data struggling open in browser window, trigger 3rd party app open.
i have tried options , got few button options(2-6) have found on stack , google, can getting open in browser?
here image of app showing console output when click on full width button , code in plunker.
http://i.imgur.com/0tfxtue.jpg
https://plnkr.co/edit/wbyfa3m19mawobtdbdfu
// ionic starter app // angular.module global place creating, registering , retrieving angular modules // 'starter' name of angular module example (also set in <body> attribute in index.html) // 2nd parameter array of 'requires' angular.module('starter', ['ionic','ngcordova']) .run(function($ionicplatform) { $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) { // hide accessory bar default (remove show accessory bar above keyboard // form inputs) cordova.plugins.keyboard.hidekeyboardaccessorybar(true); // don't remove line unless know doing. stops viewport // snapping when text inputs focused. ionic handles internally // nicer keyboard experience. cordova.plugins.keyboard.disablescroll(true); } if(window.statusbar) { statusbar.styledefault(); } }); }) .config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('tabs', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) .state('tabs.home', { url: '/home', views: { 'home-tab' : { templateurl: 'templates/home.html' } } }) .state('tabs.list', { url: '/list', views: { 'list-tab' : { templateurl: 'templates/list.html', controller: 'listcontroller' } } }) .state('tabs.detail', { url: '/list/:aid', views: { 'list-tab' : { templateurl: 'templates/detail.html', controller: 'listcontroller' } } }) // if none of above states matched, use fallback $urlrouterprovider.otherwise('/tab/home'); }) .controller('listcontroller', ['$scope', '$http', '$state','$cordovabluetoothserial', '$location', function($scope, $http, $state, $cordovabluetoothserial, $location) { $http.get('js/abodataonly.json').success(function(data) { $scope.orders = data; $scope.whichorder = $state.params.aid; }) function onpay() { var itemsarr = []; var invoice = {}; var myitems = {}; var myitem = {}; myitem['name'] = "sphero"; myitem['description'] = "a robotic ball can controlled via apps"; myitem['quantity'] = "1.0"; myitem['unitprice'] = "129.00"; myitem['taxrate'] = '0.0'; myitem['taxname'] = 'tax'; itemsarr.push(myitem); myitems['item'] = itemsarr; invoice['itemlist'] = myitems; invoice['paymentterms'] = 'dueonreceipt'; invoice['currencycode'] = 'gbp'; invoice['discountpercent'] = '0'; invoice['merchantemail'] = 'myemail@mail.com'; invoice['payeremail'] = 'foo@bar.com'; var returnurl = 'http://wp1175175.wp220.webpack.hosteurope.de/speedhack/index.html'; var returl = encodeuricomponent(returnurl + "?{result}?type={type}&invoiceid={invoiceid}&tip={tip}&email={email}&txid={txid}"); var pphereurl = "paypalhere://takepayment/v2?returnurl=" + returl; //var pphereurl = "paypalhere://takepayment/?"; pphereurl = pphereurl + "&accepted=cash,card,paypal"; pphereurl = pphereurl + "&step=choosepayment"; pphereurl = pphereurl + '&invoice=' + escape(json.stringify(invoice)); console.log(pphereurl); return pphereurl; } $scope.pay = function () { window.location = onpay(); }; }]);
give try
var url = onpay(); window.open(url , '_blank');
Comments
Post a Comment