angularjs-directive

Dynamically adding an attribute Directive to a transclude Directive in AngularJS

非 Y 不嫁゛ 提交于 2019-12-11 08:31:44
问题 I'm attempting to dynamically add an attribute Directive to a transclude directive. For example, the template would start off as follows: <div class="container"> <div ng-transclude></div> </div> After an event takes place (eg. a click), it would then have an attribute Directive added, such as: <div class="container" some-directive> <div ng-transclude></div> </div> I'm using the following JavaScript to do this: div = angular.element("#demoParentDirective .container").clone(); div.attr('some

How to store the value of model in a variable?

筅森魡賤 提交于 2019-12-11 08:29:51
问题 I am creating a directive, in which i want to compare the value stored in a model (say "name" as model and it is having value "Angular") to be stored in a variable. I tried something like below, var nameValue=name; but it(nameValue) is not having the value "Angular" Example: app.directive('kmRadio', function() { return{ restrict:'E', compile: function(element,attrs) { var model=ngModelName; console.info(attrs.kmModel); console.info("{{'+attrs.kmModel+'}}"); if(attrs.kmTitle==model) {

angular filter with dynamic list of attributes to search

℡╲_俬逩灬. 提交于 2019-12-11 08:18:22
问题 my goal it to create a search box that will filter a collection either by searching all the fields, or by a specific attribute. this will be determined by a select. so, here's what i got it is able to search by specific attribute, as expected, using this custom filter: my html- <tr ng-repeat="smartphone in smartphones | filter: search "> JS- $scope.search = function (item){ if (item[$scope.selectedSearchBy].indexOf($scope.query)!=-1) { return true; } return false; }; note that in order to

AngularJS: Objects inside nested directives getting undefined?

别说谁变了你拦得住时间么 提交于 2019-12-11 08:16:01
问题 So, I have two directives, one that has a template file, which contains another directive of the same type. The first directive looks like: .directive('billInfo', function () { return { // scope: true, scope: { obj: '=' }, restrict: 'E', templateUrl: 'views/templates/bill-info.html', link: function (scope, element, attrs) { scope.status = scope.obj.getStatus(); scope.bill = scope.obj; } } }) And the template is pretty simple, something like; <h4> <span class="glyphicon glyphicon-cutlery"> {

AngularJS formatter - how to display blank instead of zero

限于喜欢 提交于 2019-12-11 07:58:18
问题 Please see this previous question: Format input value in Angularjs The issue I am having is that (as is the case in the fiddle in the answer to the question above, i.e. http://jsfiddle.net/SAWsA/811/), hitting backspace on a single number remaining in the input leads to a zero appearing rather than clearing the input. Fiddle directive code: fessmodule.directive('format', ['$filter', function ($filter) { return { require: '?ngModel', link: function (scope, elem, attrs, ctrl) { if (!ctrl)

Angular: How to get an element by id with an expression from a directive?

纵饮孤独 提交于 2019-12-11 07:28:50
问题 Bulky question ahead so let's break this down. I try to achieve a similar behavior like the native <label> for <input> . I can't nest them so I use a style like this: <input type="checkbox" id="test" /> Some other content... <label for="test">Lorem ipsum</label> In my case <label> is a custom directive and <input> is an arbitrary elment. It could look like this: <p id="test">Some element...</p> Some other content... <custom-directive for="test">My directive</custom-directive> Sadly my id isn

Transclusion within nested element with jQuery Steps

孤街浪徒 提交于 2019-12-11 07:18:43
问题 I'm attempting to integrate jQuery Steps (Wizard generator) in an Angular.js application with a nested Google Maps element from angular-google-maps (https://github.com/angular-ui/angular-google-maps). However, I get this error: https://docs.angularjs.org/error/ngTransclude/orphan - "Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found." It looks like I have been using $compile during the Angular.js link phase, but the <div ng-transclude

angularjs function in parent directive not getting called from transcluded html

与世无争的帅哥 提交于 2019-12-11 07:15:50
问题 I have created a dropdown list like feature using angualrjs directive, The directive is working somewhat but not in correct way I expected. Following are the issues which I am facing. The drop-down list alignment is correct for static but not for dynamic I am not able to select any of the option list since getValue function which I have defined in the parent directive is not been invoked from the trancluded directive Can anyone please tell me some solution for this My code is as given below

How do I get my model to my Directive?

心不动则不痛 提交于 2019-12-11 06:58:06
问题 First time playing with directives. I'm trying to make a list that has clickable rows, it's not doing much yet, but I'm stuck trying to figure out how to get the model to the directive. Here's the directive: var tsUui=angular.module('ts-user-ui',[]); tsUui.directive('userList', function(){ return{ restrict: 'A', template: '<table>'+ '<tr>'+ '<th>User Name</th>'+ '<th>First Name</th>'+ '<th>Last Name</th>'+ '<th>Email Address</th>'+ '</tr>'+ '<tr ng-repeat="user in '+users+'" ng-click=

Angular JS conflict with Jquery

对着背影说爱祢 提交于 2019-12-11 06:51:30
问题 I am developing a widget using Angular. I have an index.html file and script.js file. From the index.html i included the script.js file. The scripts.js file is checking the Angular is already loaded or not. If the Angular is not loaded then latest Angular.min.js (tried 1.3.14 version) is dynamically appended to the head tag. And on success of Angular load I created angular module like angular.module("widgetApp", []) . This is working fine. But if I included a jQuery js (tried <2 and >2