Answer the question
In order to leave comments, you need to log in
How to display data - Sails.js / EJS or AngularJS?
Good afternoon
I'm doing a small educational project on Sails + Angular.
It is necessary to display data from the database, roughly speaking, a list of users registered in the system.
There are two options - to form a list and display it using Sails.js / EJS via
User
.find()
.exec(function(data){
return res.view('users_view',{users:'users'});
})
<% users.forEach(user){%>
<li><%=user.name%></li>
<% } %>
$http
.get('/user')
.success(function(data){$scope.users = data})
<div ng-repeat="user in users">
{{user.name}}
</div>
Answer the question
In order to leave comments, you need to log in
Depending on how you are going to scale in the future. The second method is preferable, since you get clean data and in the future you can work with it as you like (filters, sorting, etc.)
Please just don't interfere with the two view sources. Since you are using angular, then you have a spa, you should already display all the data through js.
zdelayte gibrit. ispolzuyle sails soket mesto http ana na mnogo bistreye i dast vam instant funksional. broste vse template file v sailejs angularjd v acerts file. potom mojete sovmestit eta vse i polzitatsa lubim metodam v budushem. zagooglite angular sails ejs videl neskolko git repo naschet etogo.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question