-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
freeze angular with subscribe #13
Comments
What errors are you seeing in the browser's console? |
I have no eror message in browser's console. All content of my console: "Congrats! You're connected to the WAMP server!" angular.min.js:102 |
Not much to go on there. Can you set a break point on that subscribe and then step through it. Angular doesn't display some exceptions when they're caught. If that doesn't give you anything, can you create a plunkr that reproduces the issue? |
I have a conflict between angular-wamp and http.get. I must inverted http. my all code is: var app = angular.module('myCart', ['vxWamp']);
app.config(function($wampProvider){
$wampProvider.init({
url: "ws://127.0.0.1:8080/ws",
realm: "realm1"
});
});
app.controller('courseCtrl', function($scope, $http, $wamp){
$scope.id_list = window.location.pathname.split('/');
$scope.id_list = $scope.id_list[$scope.id_list.length-1];
/* Request to REST api */
$http.get('/api/extended_list/1').success(function(data){
$scope.bought = data.achats;
}).
error(function(data){
console.log(data);
});
$http.get('/api/products/').success(function(data){
$scope.items = data.products;
}).
error(function(data){
console.log(data);
});
/* Wamp */
//Executed at connection to wamp server
$scope.$on("$wamp.open", function (event, session) {
console.log('We are connected to the WAMP Router!');
});
//Executed after loose or close connection with wamp server
$scope.$on("$wamp.close", function (event, data) {
$scope.reason = data.reason;
$scope.details = data.details;
});
function refreshList(args) {
console.log('toto');
}
$wamp.subscribe('refresh_add_product', refreshList);
/* Action */
$scope.addToCart = function(id){
$wamp.call('me.hory.add_to_list', [id, $scope.id_list]).then(
function(res){
console.log('product added to list');
},
function(error){
console.log('impossible to add product in list');
}
);
}
$scope.removeToCart = function(id){
$wamp.call('me.hory.remove_to_list', [id, $scope.id_list]).then(
function(res){
console.log('product removed to list');
},
function(error){
console.log('impossible to remove product in list');
}
);
}
});
app.run(function($wamp){
$wamp.open();
}) |
@yabb85 Are you saying that you had a conflict between angular-wamp and $http.get, but it's fixed now? Or are you still having issues? |
I don't understand. |
It sounds like you might have some sort of race condition. Can you recreate the issue with a plunker? |
Hi, Thanks for help |
Hi,
I use angular-wamp but i want to create a subscrite all page is not rendered.
Lines used to subscribe to event:
renderd page with this code:
redndered page with wamp.subscribe line commented:
Best regards
Laurent
The text was updated successfully, but these errors were encountered: