title: AngularJS,how to get data from an API and display it
body: <p>Im trying to learn angularJS. I'm trying to fetch the data from an API that gives artists' data in JSON format. What I'm trying to do is to fetch the name entered in the textbar and then just show the information received as JSON.
  The format that the API accepts is url/artistname + app id as request, where artistname is the input. The people who's API im trying to use have given me a valid app code, which is stored in the var id.
  I've written the following code so far, any help would be appreciated. Thanks!</p>
  
  <pre><code>    var myApp = angular.module('myApp', []);
      myApp.controller('UserCtrl', function($scope,$http){
          $scope.user = null;
          var id = "my secret id comes here";
  
          var name = $scope.searchText;
          $scope.getByID = function() {
  
              $http.get("https://rest.bandsintown.com/artists/" + name + id)
                      $scope.user = response;
                      console.log(response)
                  }
  
                });
  </code></pre>
  
  <p>Next, the html code is:</p>
  
  <pre><code>&lt;body ng-app="myApp"&gt;
      &lt;div ng-controller="UserCtrl"&gt;
          Search : &lt;input type="text" placeholder="Search Employees" ng-model="searchText"/&gt; &lt;br/&gt;&lt;br/&gt;
          &lt;button ng-click="UserCtrl.getByID()"&gt;Submit&lt;/button&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Thank you and sorry if this is a newbie question, I am indeed a newbie!</p>