April 23, 2014

Angularjs debug

在Angular js的scope中用watch查看输出和变化:

  $scope.cart = 1;
  $scope.$watch('cart', function() {
    console.log('=========='+ (new Date) + '======');
    console.log($scope.cart);
  });