Back

angular 急速入门 , 显示视图, 外加: 发起请求到后台。

发布时间: 2016-11-17 03:38:00

demo: 具体见官方的例子。 

angular.module('todoApp',[])
.controller('TodoListController', function($scope, $http){
  var todoList = this;
  //todoList.todos = [
  //  {text:'learn angular', done:true},
  //  {text:'build an  angular app', done:false}
  //];
  $http.get('http://localhost:3000/todos/list').
    then(function(response){
      console.info("== before send get request");
      todoList.todos = response.data
      console.info("== after send get request");
      console.response.data;
    });

Back