如何使用angularjs实现抓取页面内容

<html ng-app="myApp">
<head>
<title>angularjs-ajax</title>
<script type="text/javascript" src="js/angular149/angular.min.js"></script>
</head>
<body ng-controller="ctrl">
<input type="button" value="抓取页面内容" ng-click="method1()" /> 
<div style="border: 1px solid #ccc;width: 500px;height:400px;">{{content}}</div>
<script>
    var app = angular.module('myApp',[]);
    app.controller("ctrl",function($scope,$http){
        $scope.method1 = function() {
            $http.get("T2.action").then(function (response) {
                $scope.content = response.data;
            });
        };
    });
    </script>    
</body>
</html>

 

posted @ 2016-01-31 13:10  魔豆  阅读(506)  评论(0编辑  收藏  举报