Answer the question
In order to leave comments, you need to log in
How to refactor and review code?
Wrote the code, help evaluate its quality/style, and give advice on how to improve
Code here https://github.com/okuznetsov1/projects-angular/tr...
Answer the question
In order to leave comments, you need to log in
www.codelord.net/2016/11/23/spotting-outdated-angu...
https://github.com/rwwagner90/angular-styleguide-es6
Immediately
1) Use $resource instead of $http
2) getPriority, getTag, getStatus must return a promise
3) The controller must be thinner
4) $scope should not be used in controllers, for this you need to kill, use ControllerAs instead
1) break the code into modules
2) use es6
3)
if (type === 'simple')
{
LxNotificationService.notify(text);
}
else if (type === 'sticky')
{
LxNotificationService.notify('text', undefined, true);
}
else if (type === 'icon')
{
LxNotificationService.notify(text, 'android');
}
else if (type === 'color')
{
LxNotificationService.notify(text, undefined, false,
}
else if (type === 'info')
{
LxNotificationService.info(text);
}
else if (type === 'success')
{
LxNotificationService.success(text);
}
else if (type === 'warning')
{
LxNotificationService.warning(text);
}
else if (type === 'error')
{
LxNotificationService.error(text);
}
switch case))) I think it will be much better here
4) Try to start writing code according to the principle:
1 function solves 1 task and not like this:
function dataProcessingIsTagsForDrawTable(){
var s;
var arrayTags = [];
//Collect an array containing tag.name to display it in the datatable
angular.forEach(vm.dataTableTbody, function (element) {
s = '';
angular.forEach(element.tags_id, function (tag) {
s += tag.tag_name + ', ';
});
s = s.substring(0, s.length - 2);
arrayTags.push(s);
});
angular.forEach(vm.dataTableTbody, function (element, key) {
element.tags_name = arrayTags[key];
});
}
in the end, I want to say don't stop writing code, the more you write code, the more you will understand how to do refactoring and code review
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question