Are you looking for a super simple WYSWYG editor and you don’t want to include any heavy library into your application. Then why not make your own using just a div. Take a look at the below directive. myApp.directive(“contenteditable”, function() { return { restrict: “A”, require: “ngModel”, link: function(scope, element, attrs, ngModel) { function read() […]
Tag: 3
Scroll to Top Angular Directive
The below directive creates a scroll to top icon on the bottom right corner of the page. On click it will smoothly scroll you position back to top. Angular Directive: function ScrollToTop() { return { template: “<a ng-click=’click()’ class=’scroll-to-top-anchor’></a>”, replace: true, scope: true, controller: function($scope) { $scope.click = function() { var startY = currentYPosition(); var stopY […]
How to render ng-repeat in reverse order
Many times you would like to render the array contents in reverse when using ng-repeat. You can do that with a simple single line code which uses the slice and reverse method. <tr ng-repeat=”subs in subjects.slice().reverse()”> </tr> The disadvantage to this way of printing the data is that the original array contents get reversed taking up your […]