I managed to solve my problem but I don’t think it’s the best way!
Based on the response of Sergio and Rafael I created an algorithm:
When accessed via URL in Node created the route that receives these parameters and saved in session the id of them so:
router.get('/:nomeDaPessoa?/:ServicoDaPessoa?', function(req, res){
var nome = req.params.nomeDaPessoa;
var servico = req.params.ServicoDaPessoa;
serviceController.getByUrl(nome, servico, function (data){
req.session.serviceUrl = data.data[0].servico_id;
req.session.professionalUrl = data.data[0].profissional_id;
res.sendfile(FRONTEND_PATH + '/views/index.html');
});
});
At the front end at the angle I created the route that to bring the correct view:
.state('service', {
url: '/:prof/:service',
templateUrl: function ($stateParams){
return '/views/detail.html';
},
controller: 'DetailController'
});
And in detailController valid if this coming from the click on the interface or via URL, with this I go to the Node and get the id’s that are in the session:
if($rootScope.service && $rootScope.service.id){ //clicou em um servico na interface, nesse caso já tenho o id dos elementos!
$scope.getDetailService($rootScope.service.id);
} else {
Service.getSession(function(data){ //Vai ao node e pega o req.session
$scope.getDetailService(data.servico_id);
});
}
Good as I said I think it’s not the best way but solve my problem! if anyone has another solution better I warn me! Valew
I found something interesting to implement what you need: [http://www.codeproject.com/Articles/806029/Getting-started-with-AngularJS-and-ASP-NET-MVC-Par] More pro final he explains the route handling
– Rafael Withoeft
Interesting this option Rafael, however I would like to not use # in the url! I tried it with ui-route but it uses # in the url!
– Fábio Rogério SJ
Fábio found something else I hope to help: [http://javascriptbrasil.com/tag/angularjs/] or [http://tableless.com.br/criando-uma-aplicacao-single-page-com-angularjs/]
– Rafael Withoeft
The first link pointed me a way, I will test and if it goes right put here the solution! Valew Rafael
– Fábio Rogério SJ
You activated the
Html5Mode
on the router?– mutlei
I don’t think @mutlei!
– Fábio Rogério SJ
To activate, you make use of the line
$locationProvider.html5Mode(false);
with the appropriate boolean, inmodule.config
of$locationProvider
.– mutlei
He solved the question Fabius?
– durtto