angularjs-directive

AngularJS Directive - How to let an event only be triggered once if otherwise it'll be triggered on multiple elements?

允我心安 提交于 2019-12-24 19:09:54
问题 This is what I currently have: http://plnkr.co/edit/L9XqEyOtRSGHc9rqFPJX I am trying to make it so that when I press the down key for the first time, the focus will move onto #div2 ; repeating the action should have the focus moving onto li > div:first-child . In the demo however, upon the first time the down key is pressed, the focus will jump to li > div:first-child directly, because both the key-map on #div1 and #div2 captured the same keydown event, so the focus jumps from #div1 to #div2

Angular Marked and Inappbrowser opening all links in the system browser

China☆狼群 提交于 2019-12-24 17:06:12
问题 I am working on an Ionic app where users can post markdown content. In order to make this work, I am using the angular-marked library. In the app, I want all markdown links to be opened in the OS's default browser so I have done two things. I have written an angular directive that forces links to open in the OS' browser using the ngCordova wrapper for cordova-plugin-inappbrowser. I have set angular-marked's configuration to render all links using this directive. The problem is that the links

stop execution of other directive on my custom element directive

Deadly 提交于 2019-12-24 16:46:03
问题 i have a custom element directive e.g. like below <my-wrapper ng-model="values.abc" unique-check="" list="list" prop="name"> </my-wrapper> This directive does require ng-model which is later being set on the inner input tag <input type="text" name="myfield" ng-model="'+attrs.ngModel+'"/> the problem happening is when I check console I can see ng-model on directive is not same as ng-model on input tag. How can I make sure that the ng-model on outer tag is not created and its created only once

Angularjs custom directive highlight text after ng repeat has run

烂漫一生 提交于 2019-12-24 16:11:52
问题 I want to create a directive that hightlights text( using jquery highlight plugin), after ngRepeat has rendered all its items. Consider following html: <div data-hightlight="" data-highlight-key="{{vm.highlight}}"> <div data-ng-repeat="item in items"> {{item.description}} </div> </div> If I put the highlight on the outer div, it is executed before the ng repeat has rendered, so nothing gets highlighted. If I put it on the inner div, the directive runs for each item which is highly inefficient

Angular ngModel different view and value

北慕城南 提交于 2019-12-24 16:00:07
问题 Does ngModel controller in directive have any option to show something different from ngModel value in view, or i have to write custom html directive for input? I wrote a comma-separator directive. everything is fine, but ngModel value change from Number to String with , . I mean can i have input with value 1000000 but it shows 1,000,000 in view? Update: In the input box shows 1,000,000 , but its value be 1000000 . Update 2 I know about $formatters and $parsers . but the problem is

How to properly use formatter and editor in Slickgrid

两盒软妹~` 提交于 2019-12-24 14:34:07
问题 We are using slickgrid in our angular directive. And we would like to use another list directive (simple select element with input) in a cell/column of Slickgrid. I want the list element to be visible when the grid is available, so user knows there is a list. Therefor I am using the list directive as formatter. It Is visible when the grid is rendered. The Problem: When the cell that holds list element is clicked, the editor mode is never fired because of the list element click event. We

Different errors for a single input in Foundation Abide / AngularJS

余生颓废 提交于 2019-12-24 14:23:10
问题 I'm trying to setup a form with Foundation and I'm finding it difficult to do more than basic error checking. Lets say I have the following input field: <input pattern="username" required type="text" placeholder="username" /> Assuming the username regex is a custom pattern something along the lines of this: ^[A-Za-z]{3,6}$ What I need to be able to do is show different errors depending on whether the string in the input field is above or below that character limit. As far as I can tell

$compile showing uncaught TypeError: undefined is not a function

假装没事ソ 提交于 2019-12-24 14:18:50
问题 I am using the following code. To target the particular element and append a <div> inside that but getting uncaught typeerror: undefined is not a function for $compile(newDirective)($scope); $scope.grid= function (targetElement) { console.log("target element",targetElement) var newDirective = angular.element("<div style='height:200px' > Sample code </div>"); targetElement.append(newDirective); $compile(newDirective)($scope); } 回答1: Try this code. $scope.grid= function (targetElement) { var

Wrap ag-grid in an Angular Directive

只愿长相守 提交于 2019-12-24 14:00:07
问题 I am creating a wizard to add a new appointment in our application. The last page of the wizard contains a tabbed section with all potential conflicts based on several criteria. Each tab is one of the criteria and uses an Angular Grid to show the list of conflicts. Since each grid has the same columns, but contains different data, I would like to use a directive to wrap the Angular Grid and its grid options in the Template and then set the rowData in another attribute on my directive. I

Integrating directive in Angular UI Modal

旧城冷巷雨未停 提交于 2019-12-24 13:35:16
问题 In this plunk I have the following: A control object shared between the controller and the directive. The directive declares a method in the control object. The controller invokes the method to set a value. The directive is included in an Angular UI Modal. For some reason the control object is empty when the modal is opened (look at the console log). How to invoke the method from the controller to set the field value? HTML <div ng-app="app" ng-controller="myCtl"> <button ng-click="openModal()