angularjs--$http
1<! DOCTYPE html>234<meta charset= "UTF-8" >5<meta name= "viewport" content= "Width=device-width, initial-scale=1, maximum-scale=1, User-scalable=no" >6<title>index</title>7<link href= "{$Think. Const. Cssurl}bootstrap.min.css "rel=" stylesheet "type=" Text/css "/>8<script src= "{$Think. Const. Js}jquery.min.js "type=" Text/javascript "></script>9<script src= "{$Think. Const. Js}bootstrap.min.js "type=" Text/javascript "></script>Ten<script src= "{$Think. Const. Js}angular.min.js "type=" Text/javascript "></script> One<link href= "{$Think. Const. Cssurl}home/index.css "rel=" stylesheet "type=" Text/css "/> A -<body ng-app= "MyApp" ng-controller= "Myctrl" > -<divclass= "Container" > theclass= "Page-header" > Front-end technology -<p>{{rows.name}},{{rows.age}}</p> -$Think. Const. Homeimg}/01.png "/> -</div> +</body> -<script> +App = Angular.module ("MyApp",[]); AApp.controller ("Myctrl",function($scope,$http){ at $http. Get ("Http://localhost/tkphp/index.php/home/index/ajax"). Success (function(res) { - $scope. rows =Res; - }) - }); -</script> - in -<?PHP to namespace Home\controller; + UseThink\controller; - classIndexcontrollerextendsController { the Public functionAjax () { * $data["name"] = "Jack"; $ $data["age"] = 10;Panax Notoginseng $this->ajaxreturn ($data); - } the } +?>
angularjs--$http