AngularJS external links

I found it was not very obvious how to have external link that coincides with you application base.

For example you have application on http://somedomain.com and on http://somedomain.com/admin you have another application. And even with href (not ng-href) and the absolute path your second application will be not accessible by link from first one. The router will keep you inside application.

The only way to solve it is to use href together with target="_self" attribute:

[javascript]
<a href="/admin" target="_self">Admin</a>
[/javascript]

And yes, this option is documented, but why it’s so hard to find?

Пишем jQuery c нуля. Часть2 – Поисковый движок и вывод результатов

В продолжение рубрики “Пишем jQuery c нуля” хотел бы рассказать о внутреннем поисковом движке, той ключевой функциональности, которая и дала название “jQuery” (Javascript query). Плюс рассмотрим момент инициализации/создания jQuery объекта.

Continue reading

ui-router debug snippet

found nice code snippet that could help you to debug ui-router issues by loggin router events in console:

[javascript]
// Credits: Adam`s answer in http://stackoverflow.com/a/20786262/69362
var $rootScope = angular.element(document.querySelectorAll(‘[ui-view]’)[0]).injector().get(‘$rootScope’);

$rootScope.$on(‘$stateChangeStart’,function(event, toState, toParams, fromState, fromParams){
console.log(‘$stateChangeStart to ‘+toState.to+’- fired when the transition begins. toState,toParams : \n’,toState, toParams);
});

$rootScope.$on(‘$stateChangeError’,function(event, toState, toParams, fromState, fromParams){
console.log(‘$stateChangeError – fired when an error occurs during transition.’);
console.log(arguments);
});

$rootScope.$on(‘$stateChangeSuccess’,function(event, toState, toParams, fromState, fromParams){
console.log(‘$stateChangeSuccess to ‘+toState.name+’- fired once the state transition is complete.’);
});

$rootScope.$on(‘$viewContentLoaded’,function(event){
console.log(‘$viewContentLoaded – fired after dom rendered’,event);
});

$rootScope.$on(‘$stateNotFound’,function(event, unfoundState, fromState, fromParams){
console.log(‘$stateNotFound ‘+unfoundState.to+’ – fired when a state cannot be found by its name.’);
console.log(unfoundState, fromState, fromParams);
});
[/javascript]

if you have you Angular app root on html element you can simply use:

[javascript]
var $rootScope = angular.element(document).scope();
[/javascript]

code is placed here.

Как на Mac открыть файл в Sublime из терминала

На всякий случай сделаю заметку, чтобы не забыть. Так как по умолчанию команда не прописывается в bin, нужно это сделать самому:

$ ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

после чего можно будет удобно открывать файлы в терминале с помощью Sublime:

$ sublime workspace/site/index.html

Good Recruiter through the eyes of a Software engineer

Suddenly I came to understanding that recruiters and developers don’t know each other. We like live in different worlds and speak different languages: sometimes on recruiting language words AngularJS, PHP and Java could mean the same. But believe me, they are not.

So this post is kind of compilation of hints and advices to let Recruiters know how you look like through the eyes of a Software engineer.

Continue reading