1.0.0 • Published 10 months ago
bonree-agent-angular-plugin v1.0.0
bonree-agent-angular-plugin
bonree-agent-angular-plugin是适配于采集angular框架数据的插件。
如何使用
- 安装
npm i bonree-agent-angular-plugin --save
在框架中导入原生使用
- 1.2-1.7 angularjs中使用
- 在head中引入
<head>
<script src="https://cdn.staticfile.org/angular.js/1.2.0/angular.min.js"></script>
<script src="https://cdn.staticfile.org/angular.js/1.2.0/angular-route.min.js"></script>
<script src="./bonree_angular_plugin.min.js"></script>
<script id="BonreeAgent" src="BonreeSDK_JS.min.js" data='{"appId":"ef775a8f65da40ffa92f02b43411343a","uploadAddrHttp":"http://10.241.60.3:8888/upload"}'></script>
<script>
Bonree_angular_plugin.BonreeAngularPlugin()
</script>
- 在主moudle中注入BonreeAngularPlugin,如下:
angular.module('routingDemoApp',['ngRoute','BonreeAngularPlugin'])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/',{templateUrl: './ajax.html'})
.when('/computers',{templateUrl: './test'})
.when('/printers',{templateUrl:'./api'})
.otherwise({redirectTo:'/'})
}])
- angular4及以上版本中使用
- 在app.component.ts主文件中导入,且在构造函数中注入Router
- 导入
import {Router,NavigationEnd} from '@angular/router'
import {BonreeAngularPlugin} from 'bonree-agent-angular-plugin';
- 注入
export class AppComponent{
constructor(private router: Router) {
BonreeAngularPlugin(router);
}
}
注意:
需要配合原生H5 JS Agent使用
1.0.0
10 months ago