Правильное использование promise в angular.js
5 мин

Вот несколько моментов, о которых вы возможно не знали.
JavaScript-фреймворк
$('ul').on('click', 'li', function(){ // обработчик ....
html
<ul bn-delegate="li a | selectFriend( friend )">
<li ng-repeat="friend in friends">
<!-- Delegate target. -->
<a href="#">{{ friend.name }}</a>
<!-- Delegate target. -->
</li>
</ul>
//js
element.on(
"click.bnDelegate",
selector,
function( event ) {
// Prevent the default behavior - this is
// not a "real" link.
event.preventDefault();
// Find the scope most local to the target
// of the click event.
var localScope = $( event.target ).scope();
// Invoke the expression in the local scope
// context to make sure we adhere to the
// proper scope chain prototypal inheritance.
localScope.$apply(
function() {
expressionHandler( localScope );
}
);
}
);
<input ng-model="user.password"
ng-minlength="6"
form-password
form-error="Не менее 6 символов">