@shnicel

В чем ошибка? не могу вывести значение в заданный 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>

В консоль выводит,а в First_name ни фига,че не так,если что только начал изучать ангуляр
  • Вопрос задан
  • 141 просмотр
Пригласить эксперта
Ответы на вопрос 1
psixodyb
@psixodyb
Хочу, чтобы мой сын стал полубогом Frontend'a
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;
          }
      });
    }]);
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы