在我的Ionic App上打开外部链接不起作用

[英]Opening external links on my Ionic App does not work


My app contains a lot of links on different cards (each card respresents an event). When using the classical "", links are correctly shown but not followed. I have added the Cordova 'InAppBrowser' plugin but it doesn't works as expected. It is wrongly presented and links do not work either. My problem has some special situation: text containing links is stored on a JS array like this one (you can see the problematic link there, in the last event):

我的应用程序包含很多不同卡上的链接(每张卡都代表一个事件)。使用经典“”时,链接正确显示但未遵循。我添加了Cordova'InAppBrowser'插件,但它没有按预期工作。它被错误地呈现,链接也不起作用。我的问题有一些特殊的情况:包含链接的文本存储在像这样的JS数组上(你可以看到那里有问题的链接,在最后一个事件中):

$scope.eventsBulls = [
    { eventTitle: 'Clase Práctica', eventHour: '19:00', eventText: 'Clase práctica por los alumnos de Escuelas Taurinas con 6 erales de <b>López Gibaja</b>.<br/><br/><b>Entrada GRATUITA</b>', eventPlace: 'Plaza de Toros de Almería', eventIcon: 'img/icon-toro.png', show: false },
    { eventTitle: 'Corrida de Toros', eventHour: '19:00', eventText: '(1ª de Abono) Corrida de toros ganadería <b>Zalduendo</b><br/><br/><b>El Juli</b><br/><b>Alejandro Talavante</b><br/><b>López Simón</b>', eventPlace: 'Plaza de Toros de Almería', eventIcon: 'img/icon-toro.png', show: false },
    { eventTitle: 'Corrida de Toros Mixta', eventHour: '19:00', eventText: ' (2ª de Abono) Corrida de toros ganaderías <b>Luis Terrón</b> (2 Toros) y <b>Daniel Ruíz</b> (4 Toros)<br/><br/><b>Hermoso de Mendoza</b><br/><b>Enrique Ponce</b><br/><b>Roca Rey</b>', eventPlace: 'Plaza de Toros de Almería', eventIcon: 'img/icon-toro.png', show: false },
    { eventTitle: 'Corrida de Toros', eventHour: '19:00', eventText: ' (3ª de Abono) Corrida de toros ganadería <b>Núñez de Tarifa</b><br/><br/><b>Sebastián Castella</b><br/><b>Miguel Ángel Perera</b><br/><b>Paco Ureña</b>', eventPlace: 'Plaza de Toros de Almería', eventIcon: 'img/icon-toro.png', show: false },
    { eventTitle: 'Corrida de Toros', eventHour: '19:00', eventText: ' (4ª de Abono) Corrida de toros ganadería <b>Victorino Martín</b><br/><br/><b>Manuel Escribano</b><br/><b>Torres Jeréz</b><br/><b>Román Collado</b> (<a class="item" href="#" onclick="window.open(\'http://www.romancollado.com/\', \'_system\',\'location=yes\'); return false;">Información</a>)', eventPlace: 'Plaza de Toros de Almería', eventIcon: 'img/icon-toro.png', show: false }
];

As embedding HTML text can cause problems, I used this:

由于嵌入HTML文本会导致问题,我使用了这个:

<p ng-bind-html="event.eventText" style="text-align: justify;"></p>

So text is correctly parsed into HTML, but I don't know if this is causing problems.

因此,文本被正确解析为HTML,但我不知道这是否会导致问题。

As said, links are not shown nor followed now. I have tried escaping the ' character as compiler complains about it but still no luck.

如上所述,现在没有显示或遵循链接。我试图逃避'角色,因为编译器抱怨它但仍然没有运气。

Any suggestions?

1 个解决方案

#1


0  

I managed to solve this by following instructions here and using the filter they suggest (I needed to use '_system' becase I have 'tel:' links too that do not work on InApp browsing):

我设法通过按照这里的说明并使用他们建议的过滤器来解决这个问题(我需要使用'_system'因为我有'tel:'链接,但是在InApp浏览中不起作用):

https://gist.github.com/rewonc/e53ad3a9d6ca704d402e


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2016/08/06/531d8a18f3e81329f4eee9bc4521728.html



 
© 2014-2018 ITdaan.com 粤ICP备14056181号