<?php
$news=[
'人民币貶值',
'黃金漲價',
'樓市崩盤',
];
echo json_encode($news);
?>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/angular.js/1.5.8/angular.min.js"></script>
</head>
<body>
<h1>angular擷取新聞,并放在li裡面</h1>
<ul ng-app="news" ng-controller="contro">
<li ng-repeat="n in news">{{n}}</li>
</ul>
<script>var app = angular.module('news',[]);
app.controller('contro',function($scope,$http){
$http.get('news.php').success(function(res){</script>
</body>
</html>