angularjs-directive

Angularjs custom directive child scope access parent scope method?

元气小坏坏 提交于 2019-12-13 04:30:33
问题 I am trying to create a carousel with AngularJS ans UI Bootstrap. Since the carousel in UI bootstrap only supports images, I wan to write my own directive to support youtube video. I want the video to start to play when the video slide is active, and pause when the slide is not active. Also I would like to pause the carousel lopping when the video is playing. So far i have done the first part but can't pause the carousel because i can't access the pause method of the carousel scope. My code:

angularjs directive link function not called from compilefunction [closed]

情到浓时终转凉″ 提交于 2019-12-13 04:27:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I want to access the ngModelController in the linking function. I am using $compile to generate the html dynamically based on the user options. as per the docs I need to return the linking function from compileFunction. but the linking function is not getting called. Plunker Link I am trying to restrict user

Select the blank option of select box programmatically in AngularJS directive

房东的猫 提交于 2019-12-13 04:23:47
问题 I have a select box with a blank option and some other options. The options are not generated with ngOptions directive, because they are generated on server side (with Symfony forms). In some cases I want to unselect the selected value of the select box. So that the blank option is selected. But I cannot get this to work. The select box does not get updated. I have created a jsfiddle to show the problem. html <div ng-controller="MyCtrl"> <form name="form"> <select ng-model="foo.hero" name=

AngularJS - Converting Incorrect Use of Service To Directive

微笑、不失礼 提交于 2019-12-13 04:23:35
问题 I have a table with a fixed width; if the data within the table exceeds the defined width, the user that the ability to scroll left and right as i have a CSS element of overflow: auto; . What i am trying to do is introduce buttons on either side of the table, so that the user can click on them, and the table will scroll to the left or right. I have achieved this using an Angular service, but on ng-click, the table only scrolls left or right once. I have a feeling this is because i have used a

functionality of angular directive before return and compile chain

一笑奈何 提交于 2019-12-13 04:23:20
问题 It is possible to run javascript in a directive before returning anything, as well as in a directive's compile step before returning anything: angular.module('foo').directive('fooDirective', [function(){ console.debug('before return'); return { restrict: 'E', controller: function($scope){ console.debug('controller'); }, compile: function(scope, elem){ console.debug('compile'); return { pre: function(scope,elem, attr){ console.debug('pre'); }, post: function(scope,elem,attr){ console.debug(

AngularJS - Directive's class name cannot bring into inner template

China☆狼群 提交于 2019-12-13 03:53:07
问题 I want to make a directive which take a class name conditionally. However, I found that my code can work only if I hardcode the class name into the class attribute. If I try to use it with any expression, its failed to work. For e.g. // HTML // Doesn't work (cannot find class="editable" in the final output template) <tit-txt ng-class="true ? 'editable' : ''" ng-model="mdEnt.phone"></tit-txt> // Works! (I can find class="editable" in the final output template) <tit-txt class="editable" ng

Trigger an attribute as function of angularjs directive

前提是你 提交于 2019-12-13 03:46:50
问题 I have this html template into fileA.directive.html : <md-button ng-click="resetForm()" class="btn btn-primary">Reset form</md-button> <user-form reset-user-fn=""></user-form> And into my fileA.directive.js : app.directive("shopAppFormCustomer", function() { return { restrict: "E", replace: true, templateUrl: "fileA.directive.html", scope: {}, controller: [ "$scope", function($scope) { $scope.resetForm = function () { // want to call reset-user-fn here } } ] }; }) Into my fileB.directive.js ,

Using directives inside directives causes binding issues

最后都变了- 提交于 2019-12-13 03:41:27
问题 We're using Angular and we're having trouble with resolving variables in directives. This fiddle shows our issue: Here's the full code: http://jsfiddle.net/VX5LE/65/ //data-translate should handle the translating of the useableButton text app.directive('window', ['translateService', function (translateService) { return { restrict: 'E', transclude: true, scope: { useableButtons: '='}, replace: true, template: '<div>' + '<button data-ng-repeat="useableButton in useableButtons" data-translate>{

angular set $scope.value in controller function is not working

北城余情 提交于 2019-12-13 03:33:30
问题 I am trying to set a angular variable value in controller function which is created by a directive. Somehow it is not working for some unknown reasons. The value is displayed when set independently but doesn't work when i try to assign value in a controller function. My code is as below, <!doctype html> <html> <head> <meta charset="UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5

anchor tags and dynamic views in angular.js

删除回忆录丶 提交于 2019-12-13 03:00:41
问题 I'm taking my first steps with angular, looks promising but i have some issues, hope someone can help. i have a long html page divided to sections each section is an anchor tag, you can navigate to it from top menu. the content in each section changes according to some parameters the user selects. so the 3rd section's content for instance can be different(template) each time. my problem: i would like to dynamically load views into the section. as i understand it i have only one ng-view that