Answer the question
In order to leave comments, you need to log in
What is the best way to organize data exchange between angular and node?
Hello, there was such a need, from one view we transfer data to the node, where they are processed and should be displayed in another view. Where is the best place to save this data, in the session?
Share your practices, I will be grateful.
Thank you.
I don't know why one of the answerers deleted the comment, but in general the architecture turned out to be suitable.
Node returns an object to the NG controller, and there we store the data in localstorage, thanks everyone.
Answer the question
In order to leave comments, you need to log in
If you use ui-route you can use this (we have version 0.2.18):
//config.js
angular.module('module').config(function($stateProvider) {
//...
$stateProvider.state('create', {
url: '/create',
templateUrl: 'app/views/create.html',
controller: 'someCtrl',
controllerAs: 'someCtrl',
pageTitle: 'somePage',
params: {
yourParametr: null, //dafault value
},
});
//...
}
//someCtrl.js
//тут переход на нужную страницу, с передачей параметров, так же можно опусть передачу параметров
angular.module('module').controller('otherCtrl', function($state) {
//...
$state.go('create', {
yourParametr: yourParametr
})
//...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question