I'm working on the angular tutorial project ---- angular-phonecat, and I got to the step-5.
Out of curiosity, I replace the original angular ajax method with jquery ajax method and left the rest untouched. After that I found I can get the right data from server but the data-binding never works.
Here is my code :
'use strict';
/* Controllers */
var phonecatApp = angular.module('phonecatApp', []);
phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function ($scope, $http) {
//$http.get('phones/phones.json').success(function(data) {
// $scope.phones = data;
//});
$.ajax({
type: "GET",
url: "phones/phones.json",
contentType: "application/json",
global: false,
success: function (data) {
$scope.phones = data;
}
});
$scope.orderProp = 'age';
}]);
Why would this happen? Am I miss anything important?