angularjs-directive

How to access scope collection object in directive to manually construct HTML snippet?

五迷三道 提交于 2019-12-24 13:08:38
问题 Follow on question from How to pass a collection to a directive in angular.js? I can't use ng-repeat inside my directive template, because I am need to manually construct an HTML snippet to pass to a jQuery plugin that I am wrapping in a directive. https://github.com/aehlke/tag-it In the example below, I either need to 1) find a way to apply elem.tagIt() AFTER the template is rendered, or 2) access tagSrc WITHIN the directive to construct that HTML snippet and then add it to elem.html()

AngularJS: sharing data between directive and external controller

回眸只為那壹抹淺笑 提交于 2019-12-24 12:44:20
问题 Basically I have: directive, data service with a promise shared service to store data retrieved control which should be updated whenever the directive invoke a data request on the data service. Relevant snippets following. Let's say the html inside directive gerSearkator contain a button which, when clicked, executes the getResults() function defined inside the directive link. It should call the service gerSearch , update the gerSearchResults service, which in turn should update the $scope

AngularJS Composite Components

两盒软妹~` 提交于 2019-12-24 12:39:54
问题 I'm trying to create a component that contains multiple child components. I'm creating a collection of directives that other developers on my team can use to create custom search forms. For example, they would create markup like: <search-panel name="myCustomSearch"> <search-field name="dates" type="dateRange"></search-field> <search-field name="categories" type="categorySelector" data="{{categories}}"></search-field> </search-panel> I have a search panel directive and several search field

Load value from db on rendering directive template

前提是你 提交于 2019-12-24 12:38:30
问题 I am stuck in a doubt I have html : <div ng-repeat="mydata in data" class="ng-scope ng-binding"> <p class="ng-binding">{{mydata.postdata}}</p> <div my-rating rating-value="rating" data-cat="post" data-id="mydata.id" ></div> <div ng-repeat="childData in mydata.personRelatedData"> {{childData.personName}} <div my-rating rating-value="rating" data-cat="person" data-id="childData .id" > </div> </div> I have a Directive : myDirectives.directive('myRating', function () { return { restrict: 'A',

Using the AngularJS require option to call into another directive

与世无争的帅哥 提交于 2019-12-24 12:23:14
问题 I was just reading here about accessing one directive's controller from within another directive via the require option: http://jasonmore.net/angular-js-directives-difference-controller-link/ The directive droppable and dashboard declarations in on my view - on two different divs: <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-lg-12" data-droppable drop="handleDrop"> <div id="dash" dashboard="dashboardOptions" class="dashboard-container"></div> <

ng-include seems to do nothing

馋奶兔 提交于 2019-12-24 12:17:24
问题 http://jsfiddle.net/fresheyeball/5z7bX/ <script type="text/ng-template" id="/newTrack.html"> <h1>New Track </h1> <p>Hello there</p> </script> <div id="overlay" closemodal></div> <div id="modal"><a id="closeModal" closemodal></a> <div id="modalContent" ng-include src="/newTrack.html"></div> </div> I would expect the following result: <div id="overlay" closemodal></div> <div id="modal"><a id="closeModal" closemodal></a> <div id="modalContent" ng-include src="/newTrack.html"> <h1>New Track </h1>

ui-view doesn't work when used inside angularjs custom directives

谁说我不能喝 提交于 2019-12-24 12:04:15
问题 I want to wrap some ui-view elements inside a custom angularjs directive <wrapper> <ul> <li><a ui-sref="route1">Route 1</a></li> <li><a ui-sref="route2">Route 2</a></li> </ul> <div class="well" ui-view="viewA"></div> <div class="well" ui-view="viewB"></div> </wrapper> The custom directive does nothing but transcluding the content: myapp.directive('wrapper', function($compile){ return { restrict: 'E', replace: true, transclude:true, template: '<div class="godWrapper" ng-transclude></div>' }; }

angularjs apply multiple directives same element

折月煮酒 提交于 2019-12-24 12:04:03
问题 I have a directive with templateUrl for displaying a custom made dropdown. This directive appends DOM elements to element node without replacing it: <cross-dropdown> <!-- First Directive Template Content Start--> <div></div> <!-- First Directive Template Content End--> </cross-dropdown> Then I want to create another one for validations, so It can append more DOM elements into the content inserted by first directive, so the result will be: <cross-dropdown> <!-- First Directive Template Content

Angular, share directive template between click functions

北慕城南 提交于 2019-12-24 11:37:14
问题 I have a directive which, when called, passes in a controller and an array . In the controller I pass in, there is an object I want to loop over. my html looks like this: <div class="row"> <div class="col-md-6"> <div class="jumbotron" ng-controller="protocolCtrl as pctrl"> <button type="button" id="protocol" class="btn btn-primary btn-lg" ng-click="pctrl.getUpdatedList()" data-toggle="modal" data-target="#modal">Modify Current Protocols</button> <!--IN THIS MODAL YOU CAN ADD/CHANGE/DELETE

Stay on current page when open new tab in angular js

南笙酒味 提交于 2019-12-24 11:33:46
问题 <a class="seecode_button" href="#{{w.CouponID}}" ng-click="newwindow(w)" data-toggle="modal" data-target="#{{w.CouponID}}">CLICK Here</a> $scope.newwindow = function(w) { $window.open(w.LandingPageURL, '_self'); $window.open('#','_blank'); }; I am try to make when some one click on "CLICK Here" then need to open new window but need stay on current tab. In my code current tab open in page its ok but popup also gone because of it refresh the page . I am using angular js 1.2.17 and for popup i