Bonjour
Grand débutant avec HTML et angular.
J’ai un soucis pour récupérer les StateObject
J’ai repris les exemple de la doc et le code ci dessous marche
<script>
var myDemoApp = angular.module('MyDemoApp', ['ngConstellation']);
myDemoApp.controller('MyController', ['$scope', 'constellationConsumer', function ($scope, constellation) {
constellation.initializeClient("http://192.168.0.150:8088", "51abb9636078defbf888d8457a7c76f85c8f114c", "TestAPI");
constellation.onConnectionStateChanged(function (change) {
if (change.newState === $.signalR.connectionState.connected) {
constellation.registerStateObjectLink("*", "HWMonitor", "/intelcpu/0/load/0", "*", function (so) {
$scope.$apply(function() {
$scope.cpu = so;
});
});
}
});
constellation.connect();
$scope.cpus = {}
}]);
</script>
</head>
<body ng-controller="MyController">
<p>CPU on {{cpu.SentinelName }} at {{cpu.LastUpdate | date : 'dd//MM/yyyy @ hh:mm:ss' }} is <strong>{{cpu.Value.Value | number:2}} {{cpu.Value.Unit}}</strong></p>
Par contre quand je le change pour celui ci. sa ne marche pas
<script>
var myDemoApp = angular.module('MyDemoApp', ['ngConstellation']);
myDemoApp.controller('MyController', ['$scope', 'constellationConsumer', function ($scope, constellation) {
constellation.initializeClient("http://192.168.0.150:8088", "51abb9636078defbf888d8457a7c76f85c8f114c", "TestAPI");
constellation.onConnectionStateChanged(function (change) {
if (change.newState === $.signalR.connectionState.connected) {
constellation.registerStateObjectLink("*", "HWMonitor", "*", "*", function (so) {
$scope.$apply(function() {
$scope.cpu = so;
});
});
}
});
constellation.connect();
$scope.cpus = {}
}]);
</script>
</head>
<body ng-controller="MyController">
<p>CPU on {{cpu.SentinelName }} at {{cpu.LastUpdate | date : 'dd//MM/yyyy @ hh:mm:ss' }} is <strong>{{cpu['/intelcpu/0/load/0'].Value.Value | number:2}} {{cpu['/intelcpu/0/load/0'].Value.Unit}}</strong></p>
Cette partit ci {{cpu.HWMonitor[’/intelcpu/0/load/0’].Value.Value | number:2}} {{cpu.HWMonitor[’/intelcpu/0/load/0’].Value.Unit}}
ne marche pas.
J’ai essayer plusieurs chose mais rien ne marche. les valeurs ne s’affiche pas
Si quelqu’un peux me dire comment faire sa serait gentil