angularjs-directive

Angular scope - Isolated VS Inherited. Which one is more restrictive

ε祈祈猫儿з 提交于 2019-12-12 02:06:46
问题 I have seen several you tube videos and read other stack overflow threads but still cannot figure out which one of angular scope is more restrictive. Isolated or Inherited. From the name isolated it feels if it is the most restrictive scope but since it allows various settings like @, =, and & to me it seems less restrictive then inherited scope. So the question is which one is more restrictive and why ? 回答1: I'd venture a guess that your definition of "restrictive" has to do with access to

AngularJS creating a directive then uses another directive

我是研究僧i 提交于 2019-12-12 01:58:44
问题 I'm trying to create a directive to cut down on the boilerplate code that I'd have to write. I'm using the angular xeditable directive to allow for inline editing, but when I add the xeditable directive attributes from my directive, it doesn't work. When I say it doesn't work, I mean usually when I click on the element there is an input box that appears, and right now nothing happens when I click on the element. Glenn.directive('edit', function() { return { restrict: 'A', template: '{{

In Angular, on selected option set default values for other options

一笑奈何 提交于 2019-12-12 01:58:06
问题 Question: How can I take the selected sizes as an index to map and display the proper price and tsin eq to the sizes index Notice: I'm trying to create a relationship between sizes, prices, tsin "Black": { "sizes": "X Small, Small", "prices": '$22.24, $24.94', "tsin": "111002, 111003" }, e.g. if the color black was picked and the size selected was of index [0](or - X Small) then on ng-change the price would update to $22.24 and the tsin is 111002 UPDATE: I've updated the fiddle to get a bit

Unit testing an AngularJS (Smart Table) directive

主宰稳场 提交于 2019-12-12 01:51:44
问题 I am working with "Smart Table" and will be using their example plugin where a checkbox selects a row in a table: http://lorenzofox3.github.io/smart-table-website/#section-custom I am writing a unit test for this directive, code below, this is failing. Has anyone written a unit test for this code or could help direct me as to where I am going wrong and if I am actually testing the correct logic? Directive: myApp.directive('csSelect', function () { return { require: '^stTable', template: '',

How to change select functions in Angular Directive?

社会主义新天地 提交于 2019-12-12 01:49:44
问题 http://plnkr.co/edit/pJRzKn2v1s865w5WZBkR?p=preview I have a large select dropdown form which is repeated in 2 places. The only thing that changes is the first select tag, which has a different function. <!-- On simple, change ng-change function to functionOne On advanced, change ng-change function to functionTwo --> <select name="name1" ng-change="functionOne('function1')" id="the-id-1"> <select name="name2" ng-change="functionTwo('function2)" id="the-id-2"> <option value="aaa">aaa</option>

Add ng-if attribute to a element from within a directive

一笑奈何 提交于 2019-12-12 01:49:27
问题 I have a AngularJS directive which takes an ID and makes a lookup on this ID to get col-width, hide-state and order for a given flexbox element. What I d like to do is to add a ng-if=false attribute to the element if its hide-state is true. Is there any way, how I can add ng-if attribute from within a directive to a element? My current code: .directive("responsiveBehaviour", ['ResponsiveService', function(ResponsiveService){ var linkFunction = function(scope, element, attributes){ var id =

how to display sorted only 25 element in infinite scroll?

混江龙づ霸主 提交于 2019-12-12 01:47:07
问题 I am using infinite scroll in my demo ,In which I am showing only 25 element first time .When user scroll down to bottom it load more data and display that more data .It is do repeat steps if user want whole data to display (scroll to bottom load more data).but in my demo there is ascending and descending functionality present .On header there is "V" and "^" Button present .using click of that button I need to ascend and descend data .In my demo it is working fine .But the issue is when user

Directive - Dependency Injection do not resolve (controllerAs syntax)

人盡茶涼 提交于 2019-12-12 01:46:30
问题 I am Trying to follow the rules on https://github.com/johnpapa/angular-styleguide#style-y075 , and i am trying to inject the dependencies, and unfortunatly, it fails on GetDiscussionThreadListService HTML : <discussion-parent someParam></discussion-parent> JS : var xDiscussionsDirectives = angular.module('xxx.discussions.parent', ['ngResource']).directive('discussionParent', discussionParrentDirective); function discussionParrentDirective() { var directive = { restrict: 'E', scope: {

angular: watch for filtered value in directive

吃可爱长大的小学妹 提交于 2019-12-12 01:36:46
问题 I'm trying to implement a directive that draws a chart based on given values. I want the pass the data for the plot from the template. I have a working solution, passing the data in ng-model , for which I can then add a $scope.watch statement. But that doesn't work with filtered data, and I don't need two-way binding. Ideally, the html should look like: <chart ???????="list | filter" /> The directive, I guess, should look like: return{ restrict: 'C', link: function(scope, elem, attrs){ var

can't getting textarea value using AngularJs

ぃ、小莉子 提交于 2019-12-12 01:36:23
问题 <tr class="labels"> <td nowrap="nowrap">Address</td> <td nowrap="nowrap"><label for="tbAddress"></label> <textarea name="tbAddress" id="tbAddress" cols="39" rows="5" ng-model="$parent.tbAddress"></textarea> </td> </tr> <tr> <td> </td> <td align="right"> <input type="submit" name="button" id="button" value="Submit Record" class="btns" /> <input type="reset" name="button2" id="button2" value="Cancel" class="btns" /> </td> </tr> I'm not be able to get textarea value using AngularJS. All the