Answer the question
In order to leave comments, you need to log in
Where is the mistake? can't output value to given div id?
<script>
var app = angular.module('app',[]);
app.controller("profileCtrl", function($scope){
var req="https://api.vk.com/method/users.get?user_ids=1"
$.ajax({
url : req,
type : "GET",
dataType : "jsonp",
success : function(msg){
console.log(msg.response[0].first_name);
$scope.resp = msg.response[0].first_name;
}
});
});
</script>
<body ng-app="app">
<div class="container">
<div class="profile" ng-controller="profileCtrl">
<div id="First_name">{{ resp }}</div>
<div id="Last_name"></div>
<div id="City"></div>
<div id="Avatar"></div>
</div>
</div>
</body>
Answer the question
In order to leave comments, you need to log in
var myApp = angular.module('myApp',[]);
myApp.controller('profileCtrl', ['$scope', function($scope){
var req="https://api.vk.com/method/users.get?user_ids=1"
$.ajax({
url : req,
type : "GET",
dataType : "jsonp",
success : function(msg){
console.log(msg.response[0].first_name);
$scope.resp = msg.response[0].first_name;
}
});
}]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question