0

No java script events are triggering inside ng-show div in my code. Please find my code in the below plnkr link.

http://plnkr.co/edit/kGqk8x?p=preview

After loading the data from json i am making ng-show as true. But inside the div i have a button which is not allowing to do any of the js events. It looks like a image for me. Please help me to know where i am going wrong.

Here is my code

<body ng-controller="ArtSearch">
    <div ng-show="isShow">
        <table class="tbl_cls">
            <tr ng-repeat="item in names">
                <td>{{item.artistName}}</td>
                <td>{{item.trackName}}</td>
                <td>{{item.artworkUrl30}}</td>
                <td>{{item.shortDescription}}</td>
            </tr>
        </table>
        <div align="center">
            <button value="asdf"></button>
            <a href="#" class="button">Search</a>
        </div>
    </div>
    <div id="searchForArt">
        //some code
        <div align="center">
            <a href="#searchForArtist" class="button" ng-click="searchCall()">Search</a>
        </div>
    </div>
</body>

  [1]: http://plnkr.co/edit/kGqk8x?p=preview
Rashwan L
  • 38,237
  • 7
  • 103
  • 107
voidmain
  • 65
  • 1
  • 7

1 Answers1

0

One thing you need to do is move the $scope.isShow=true inside of your promise like so:

$http.get("http://itunes.apple.com/search?term=jack&limit=4")
    .then(function(response) {    
        $scope.names = response.data.results;
        $scope.isShow=true;
    });

But even this is not going to solve your problem. I'm pretty sure you'll never hit your .then because of how you wrote your http request. It will get blocked as a cross-origin request every time. If you want to see for yourself, open the browser console and try to click the search button. Go here to see how to use jsonp to bypass this.

Community
  • 1
  • 1
branweb
  • 171
  • 7