Skip to content
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

The directive does not work on iOS cordova app #25

Open
sarahsga opened this issue Dec 20, 2016 · 2 comments
Open

The directive does not work on iOS cordova app #25

sarahsga opened this issue Dec 20, 2016 · 2 comments

Comments

@sarahsga
Copy link

The $compile in the directive does not work on iOS cordova app, and prevents the HTML from getting rendered at all.

@wytrych
Copy link
Collaborator

wytrych commented Dec 21, 2016

Thanks for reporting. Do you mind sharing some code? You're also welcome to submit a PR.

@sarahsga
Copy link
Author

sarahsga commented Jan 28, 2017

@wytrych
I solved it.

Here is the HTML that I wanted to bind to a scope variable:

facts.html

<div id="content" bind-html-compile="dynamicHTML" >

facts.controller.js

$http.get(url)
        .then(
        function(response){
          $scope.dynamicHTML = response.data;
        }

The content div, as a result, rendered nothing at all on Safari(web) and iOS (cordova)

The line in the bind-html-compile directive that was causing the rendering issue was Line 22 in angular-bind-html-compile.js
$compile(element.contents())(compileScope);
It prevented anything from rendering at all.

I wanted to enable click on just one anchor tag inside $scope.dynamicHTML. I replaced Line 22 above with the following code:
$compile(element.contents().find( "a" ))(compileScope);

That solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants