angularjs-directive

input textbox: mimic “clear text” X button just like select2 dropdown component

梦想的初衷 提交于 2019-12-11 16:47:06
问题 I've been using select2 as my UI of choice for my website. However, I noticed that there is a feature used for select2 that I feel should be used for my textbox; the clear all feature. http://ivaynberg.github.io/select2/ I've seen numerous posts around the web on how to add a clear button into a textbox element, but none seemed to suit my interests. Because I'm working with select2, I want my input boxes to have the same look at and feel as my select2, which is to include the "clear button".

how to add icons in row which is generated dynamically in ionic

拥有回忆 提交于 2019-12-11 16:27:38
问题 I am trying to make simple demo in ionic .I have one footer having one icon ion-compose (bottom left icon).When i click on that icon it show a pop up screen I enter name in text field and press save button .then it generate a row which have same text as written in textfield of popup screen.I need to add icon buttons on row (like delete button , edit button).can we add icon on dynamically generated row as I did in footer (bottom left ion-composer). Please add ion on row here is my code http:/

Directive's isolated scope variables are undefined if it is wrapped in a directive which has in its template ng-if and tranclusion enabled

扶醉桌前 提交于 2019-12-11 16:26:36
问题 I am facing is an issue which is demonstrated in the following example: http://jsfiddle.net/nanmark/xM92P/ <div ng-controller="DemoCtrl"> Hello, {{name}}! <div my-wrapper-directive> <div my-nested-directive nested-data="nameForNestedDirective"></div> </div> </div> var myApp = angular.module('myApp', []); myApp.controller('DemoCtrl',['$scope', function($scope){ $scope.name = 'nadia'; $scope.nameForNestedDirective = 'eirini'; }]) .directive('myWrapperDirective', function(){ return { restrict:

Pass argument to directive in angularjs?

时光毁灭记忆、已成空白 提交于 2019-12-11 16:25:50
问题 I want to pass argument to directive in angularjs. I found some thread on stackoverflow Angularjs - Pass argument to directive But it is not helped me. Directive: app.directive('datePicker', function () { return { restrict: 'E', replace: true, template: '<input type="text" class="form-control" ng-model="modelValue">', scope: { modelValue: '=', format: '@', }, link: function (scope, element, form) { $(element).datepicker({ dateFormat: format, }); } } }) Element: <date-picker model-value=

AngularJS: ngMessages not working with ng-options in select

谁都会走 提交于 2019-12-11 15:54:35
问题 I have seen few answers which were working for ng-repeat, but with ng-options I am facing issue. Problem : Want to show the error message required if the dropdown is touched and nothing is selected, I am able to do this with input fields. JS CODE $scope.personMap = [{ name:"Abc", id:"a"}, { name:"XYZ", id:"b"}, { name:"FGH", id:"c"}, { name:"TY", id:"d"} }] HTML <select name="inpName" ng-model="person.name" ng-options="i as i.name for i in personMap track by i.id" required> <option value=""

AngularJS : Custom directive scope not being initialized properly when used with ng-repeat

懵懂的女人 提交于 2019-12-11 14:54:02
问题 I have a problem with passing object information to my custom directive, which has an isolate scope. I have boiled my problem down to this simple plnkr to demonstrate the wall I am hitting: http://plnkr.co/edit/oqRa5pU9kqvOLrMWQx1u Am I just using ng-repeat and directives incorrectly? Again, my goal is to pass the object information from the ng-repeat loop into my directive which will have its own scope. HTML <body ng-controller="MainCtrl"> <ul> <li ng-repeat="i in items", my-directive="i">

AngularJS: Manipulate the $scope of an unknown $element

安稳与你 提交于 2019-12-11 14:48:49
问题 New to Angular. I'm creating a directive (attribute) for global use through the whole project. I'm using a local storage function and my intention is to have the element, on which the attribute is situated, change its value/text accordingly. Here is the HTML: <input type="email" name="username" placeholder="Email Address" ng-model='username' loadstorage="USERNAME" /> Here is the directive: .directive("loadstorage", function (localStorage) { return function ($scope, $element, attrs) { $scope.

AngularJS : How to properly transclude child elements in custom directive?

怎甘沉沦 提交于 2019-12-11 14:37:05
问题 Here's some code : link I'm trying to create a directive that wraps its children in some boilerplate. But if the children have ng-if controlling their appearance, the "transclusion" doesn't work. Well it sort of does, but as you can see the ng-if logic is not getting passed through correctly. I'd like to know how to fix it, but also where (if anywhere) this is described in the Angular docs. 回答1: The problem is that Angular initially replaces ngIf with a comment that it uses to track where to

Bootstrap Switch not firing SetState event in angular directive

ⅰ亾dé卋堺 提交于 2019-12-11 14:36:00
问题 i am using a Wrapbootstrap template. and converted it into a single page application using its routing and ng-view kind of a stuff. this third party template seems to be using bootstrap switch. but its not referencing bootstrap-switch.js, instead it has something called toggler.js which transforms element with 'make-switch' class into a switch. Question 1 : Has the vendor tweaked Bootstrap Switch v2.0 to make this JS ? code of toggler.js ! function(e) { "use strict"; e.fn.bootstrapSwitch =

Properly filtering an input field in Angular

耗尽温柔 提交于 2019-12-11 13:56:15
问题 I found this directive for filtering a field for currency, so a user just needs to type and the decimal is implied. It works well, except that a user is able to put in a letter if they press a letter twice. I don't want them to be able to put in a letter at all. I tried changing the type="number" but then it would only allow 5 digits before disappearing inexplicably. You can see this at this plunker: http://plnkr.co/edit/Y1olj7Cdz7XKqRmE7BFb?p=preview So either I need to change something (the