Note that there are some explanatory texts on larger screens.

plurals
  1. POAngular, GitHub API, Return repositories and tags
    primarykey
    data
    text
    <p>I'm new to Angular and also fairly novice when it comes to js. I'm trying to return a list of repositories and with each one, list it's tags. I have managed to get the repositories with the following controller and factory.</p> <pre><code>//Controller claGitHub.controller('repoController', function ($scope, reposFactory) { reposFactory.getRepos().success(function(result){ $scope.repos = result; console.log(result) }); }); //Factory claGitHub.factory('reposFactory', ['$http', function($http){ var repos = []; repos.getRepos = function() { return $http.get('https://api.github.com/users/google/repos'); }; return repos; }]); </code></pre> <p>Using Angular, I can iterate through each object and output it's properties in my view, woo! The problem is the tags property is a nested JSON feed rather than links to the actual tag urls. e.g.</p> <pre><code>tags_url: "https://api.github.com/repos/google/autoparse/tags" </code></pre> <p>So I have tried iterating through each object, making another AJAX call based on it's tags_url property with limited success. My patchy knowledge has meant I simply can't work out where it should go and how it should look syntactically. Do I make another factory and controller? Or should it be part of the existing code? Any help would be much appreciated!</p> <p>Here's my view for good measure:</p> <pre><code>&lt;!-- Repeating section for featured repositories --&gt; &lt;div data-ng-repeat="repo in repos" class="repo-tile"&gt; &lt;h2&gt;{{repo.name}}&lt;/h2&gt; &lt;ul&gt; &lt;li&gt;{{repo.description}}&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload