Solved

angular http request

Posted on 2014-12-11
2
119 Views
Last Modified: 2014-12-11
question, Im new angularjs and my http api request worked with angular 2.1 but with the latest it does not work. nor can I use my module.

http://jsfiddle.net/sevensnake/f89jbcry/3/

and help why it stopped working would be great.
0
Comment
Question by:sevensnake77
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40494815
Updated : http://jsfiddle.net/f89jbcry/4/

var myAppModule = angular.module('myApp',[]);
var MainCtrl = function($scope, $http) {

  var onUserComplete = function(response) {
    $scope.user = response.data;
  };
  $http.get("https://api.github.com/users/Sevensnake")
    .then(onUserComplete);

  $scope.message = "hello,sev"; 
};

var myCtrl = myAppModule.controller("MainCtrl", MainCtrl);

var mytest = function($scope) {
    $scope.newline = "whats up";
};

Open in new window

0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 40494905
thanks  i would not think I had to add another var to module.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now