<html ng-app="feed">
<head>

<script type="text/javascript" 
src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" 
src="bower_components/storedb/storedb.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script>
google.load("feeds","1")
var ggrss = (function(){
      var cache = [];
      
      return {
        parse: function(url,num,callback){
 
          function initialize() {
            var feed = new google.feeds.Feed(url);
            feed.setNumEntries(num);
            feed.load(function(result) {
              if (!result.error) {
                for (var i = 0; i < result.feed.entries.length; i++) {
                  var entry = result.feed.entries[i];
                  cache.push(entry)
                }
                callback(result.error,cache)
              }
            });
          }
          google.setOnLoadCallback(initialize);
        },
 
      }
}())

</script>
<script type="text/javascript">


var app = angular.module('feed',[]);
app.controller('feedCtrl',function($scope){
  $scope.feedList = storedb('feed').find()
  $scope.addFeed = function(feedName,feedURL){
    
storedb('feed').insert({"feedName":feedName,"feedURL":feedURL},function(err,res){
      $scope.feedList = storedb('feed').find()
    })
  }

  *$scope.showTitle = function(){*
*    ggrss.parse('http://36kr.com/feed',4,function(err,res){*
*      alert('a')*
*    })*
*  }*
})

</script>


<body ng-controller="feedCtrl">
  <div>
    <input ng-model="feedName" placeholder="Feed Name" />
    <input ng-model="feedURL" placeholder="Feed URL" />
    <button ng-click="addFeed(feedName,feedURL)">Add</button>
    <ul ng-repeat="feed in feedList">
      <li><a ng-click="showTitle()">{{feed.feedName}}</a></li>
    </ul>
  </div>
  <div>
    <ul ng-repeat="feed in feeds">
      <li>{{feed.title}}</li>
    </ul> 
  </div>
</body>
</html>

Is there anything wrong in the *ggrss *function? Or it is the matter with 
AngularJS?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to