/
detail.html
46 lines (36 loc) · 1.32 KB
/
detail.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.js"></script>
<body>
<script>
var app = angular.module("myApp", ['ngSanitize']);
app.config(function ($routeProvider) {
$routeProvider.when('/index', {
templateUrl: '/text.html',
controller: 'myCtrl'
}).when('/student/:username', {
templateUrl: '/student.html',
controller: 'studentController'
}).otherwise({
redirectTo: "/"
});
app.controller("myCtrl", function($scope, $http, $routeParams) {
var page = $routeParams.id;
console.log(page);
$http.get("http://selintasolahraga.com/?json=get_post&post_id"+page).then(function (response) {
$scope.myData = response.data.post.content;
console.log( $scope.myData);
$scope.myText = $scope.myData;
});
});
});
</script>
<div ng-app="myApp" ng-controller="myCtrl">
<p ng-bind-html="myText"></p>
</div>
<p><b>Note:</b> This example includes the "angular-sanitize.js",
which has functions for removing potentially dangerous tokens from the HTML.</p>
</body>
</html>