Skip to content

R0dgerV/cookbook-angular

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Директивы

Дополнениe к поле INPUT что бы выполнялась функция по Enter

        .directive('myEnter', function () {
            return function (scope, element, attrs) {
                element.bind("keydown keypress", function (event) {
                    if(event.which === 13) {
                        scope.$apply(function (){
                            scope.$eval(attrs.myEnter);
                        });

                        event.preventDefault();
                    }
                });
            };
        })

Confirm для элементов html

        .directive('ngReallyClick', [function() {
            return {
                restrict: 'A',
                link: function(scope, element, attrs) {
                    element.bind('click', function() {
                        var message = attrs.ngReallyMessage;
                        if (message && confirm(message)) {
                            scope.$apply(attrs.ngReallyClick);
                        }
                    });
                }
            }
        }])

About

Фишки к AngularJs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published