quite a nice illustration from ng ofdoc
‘fuck’ – command for all the cases
Google Chrome crashe log
It not very obvious where to find crashes logs in Chrome. First thing that you need to do is make sure that you have logging option ON, you should have check on this option in Chrome setting:
Then you can go to
chrome://crashes
Taken from stackoverflow, thanks Mahai.
How to catch Angular ui-router resolve errors
It’s more than annoying to have just a blank page and no errors in console when your issue is inside ui-router resolve. Finally I found a pretty nice solution, don’t know why it’s not provided “from the box”. In case of error ui-router sends specific event $stateChangeError that we could listen for:
[javascript]
$rootScope.$on(‘$stateChangeError’, function(event, toState, toParams, fromState, fromParams, error){
console.error(error);
});
[/javascript]
and now wow! we have an exact error in console and no need to guess what’s wrong with your code anymore.
Sublime plugin for nginx config
Nginx Syntax Highlighting Plugin from Brandon Wamboldt. Don’t know why it’s not yet native for sublime.
AngularJS: ng-click и ng-disabled
Учтите что ng-disable работает только на элементах формы, поэтому тут
[html]
<div ng-click="doAction()" ng-disabled="buttonDisable">Click Me</div>
[/html]
директива ng-click отрабатывает клик.
Если необходимо использовать ng-disable могу предложить такой вот хак:
[html]
<div ng-click="buttonDisable || doAction()" ng-disabled="buttonDisable</div>
[/html]
P.S.: Большоя спасибо Vitalii Hudyma за планкер с кодом.
The Company of my Dream
I’ve already made some notes about ideal company(ru), now after one year I decided to review the points and made new list.
Android virus “whatsappupgradeservice.com”
Something really weird is going with my Android phone: from time to time it opens me browser with this link. By domain whatsappupgradeservice.com I immediately realised that it’s fake.
AngularJS и проверка данных формы
Пост состоит из следующих частей:
- Проверка данных в HTML5
- AngularJS расширения для валидации
- Свои кастомные проверки данных на AngularJS
- Вывод сообщений об ошибках и ng-messages
Angular: $scope.$on() – listen to several events
I found it quite strange that AngularJS does not have possibility to watch several Angular-events, i.e.:
[javascript]
$scope.$on([‘user.login’, ‘user.logout’], callback);
[/javascript]
and I decided to extend $on method, to make it handle such case:
[javascript]
var $onOrigin = $rootScope.$on;
$rootScope.$on = function(names, listener) {
var self = this;
if (!angular.isArray(names)) {
names = [names];
}
names.forEach(function(name) {
$onOrigin.call(self, name, listener);
});
};
[/javascript]
Sandbox for this code you can find here.