angularjs-directive

ng-click attribute on angularjs directive

ぐ巨炮叔叔 提交于 2019-12-17 23:11:11
问题 I think it should be easy to use the well known angular attributes on a directive out of the box. For example if the name of my directive is myDirective I would like to use it this way: <div ng-controller="myController"> <my-directive ng-click="doSomething()"><my-directive> </div> instead of needing to define a custom click attribute (onClick) as in the example below <div ng-controller="myController"> <my-directive on-click="doSomething()"><my-directive> </div> It seems that ng-click can work

How to nest two directives on the same element in AngularJS?

谁说我不能喝 提交于 2019-12-17 22:33:53
问题 When I try to nest two directives on the same element I get the following error. Nested "E" directives - Multiple directives [...] asking for new/isolated scope , I want to nest two "E" isolated scoped directives, like in this fiddle. (To actually reproduce the problem, you need to uncomment the <lw> directive) I keep getting this error that I don't understand/know how to fix: Error: [$compile:multidir] Multiple directives [lw, listie] asking for new/isolated scope on: <listie items="items

How to execute parent directive before child directive?

孤街醉人 提交于 2019-12-17 22:19:07
问题 I'm looking to write two angular directives, a parent and a child directive, to create sortable and cloneable widgets. The intended markup is: <div class="widget-container" data-sortable-widgets> <section class="widget" data-cloneable-widget></section> <div> However, the child directive seems to execute before the parent, before a certain element is available (its added by the parent): function SortableWidgetsDirective() { return { priority: 200, restrict: 'A', link: function ($scope, element

Change class on mouseover in directive

假装没事ソ 提交于 2019-12-17 21:44:36
问题 I am having trouble working out how to get a class to change on a nested directive. This is the outer ng-repeat <div data-courseoverview data-ng-repeat="course in courses | orderBy:sortOrder | filter:search" data-ng-controller ="CourseItemController" data-ng-class="{ selected: isSelected }"> Below is the inner ng-repeat which is using another directive <li data-ng-repeat="item in social" class="social-{{item.name}}" ng-mouseover="hoverItem(true);" ng-mouseout="hoverItem(false);" index="{{

how to make view (form)from json using angular?

家住魔仙堡 提交于 2019-12-17 20:56:25
问题 I am trying to make view from json .When I have array of objects .I am able to make view and validate that view . If I have this array of object ,in that case I make able to view , check plunker http://plnkr.co/edit/eD4OZ8nqETBACpSMQ7Tm?p=preview [{ type: "email", name: "email", required:true }, { type: "text", name: "name", required:true }, { type: "number", name: "phonenumber", required:true }, { type: "checkbox", name: "whant to check" }, { type: "url", name: "server Url" }]; Now the

Angular JS - Load a template html from directive on click of a button

℡╲_俬逩灬. 提交于 2019-12-17 19:17:51
问题 I am trying to load a HTML template when a link is clicked. I have made a directive that contains templateUrl which loads a HTML file. I am calling a function when a link is clicked that appends a div with our custom directive "myCustomer" to a div already in index.html. whatever i have done so far is shown below, but it doesn't work. index.html <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-example12-production</title> <script src="//ajax.googleapis

amCharts with AngularJS

坚强是说给别人听的谎言 提交于 2019-12-17 19:16:30
问题 I'm still strugling making work other libs with AngularJS because of it's differtent logic from other libs. I need to visualize data with amCharts Stock, but there is nothing on the internet about these two wroking together. How can i make this work with angularjs: http://jsfiddle.net/922JW/ var chart = AmCharts.makeChart("chartdiv", { type: "stock", "theme": "none", pathToImages: "http://www.amcharts.com/lib/3/images/", categoryAxesSettings: { minPeriod: "mm" }, dataSets: [{ color: "#b0de09"

Create Hoverable popover using angular-ui-bootstrap

*爱你&永不变心* 提交于 2019-12-17 18:42:22
问题 I have the following code for creating a popover in my template file: <span class="icon-globe visibility" id="visibilityFor{{post.metaData.assetId}}" popover="{{post.visibilityListStr}}" popover-placement="right" popover-trigger="mouseenter" popover-popup-delay="50" visibility> </span> I have a few clickable links on the popover. But the problem is I'm not able to hover on the popover created. I referred to the link http://jsfiddle.net/xZxkq/ and tried to create a directive viz. 'visibility'

Decorating the ng-click directive in AngularJs

帅比萌擦擦* 提交于 2019-12-17 18:39:20
问题 I've been looking into modifying the AngularJS ng-click directive to add some additional features. I have a few different ideas of what to use it for, but a simple one is to add Google Analytics tracking to all ng-clicks, another is to prevent double clicking. To do this my first thought was to use a decorator. So something like this: app.config(['$provide', function($provide) { $provide.decorator('ngClickDirective', ['$delegate', function($delegate) { // Trigger Google Analytics tracking

AngularJS: Call the ng-submit event outside the form

拈花ヽ惹草 提交于 2019-12-17 18:27:52
问题 I'm a fish in AngularJS and I have this scenario. <form> <input type="text"> </form> <button type="submit">submit</button> In normal ways AngularJS provides the ng-submit directive to work as an attribute in the form but I need to call it outside. So, someone has experienced the same problem? If yes, what you did? 回答1: Please, surround your code with a ng-controller, and use ng-click on buttons out of scope of <form>. I make a sample on jsfiddle for you... try it: http://jsfiddle.net/xKkvj/2/