angularjs-directive

Angular directive: How to make assign value to parent scope?

时光怂恿深爱的人放手 提交于 2020-01-04 15:18:22
问题 I have a controller AppCtrl as scope.transaction = {} The index looks like <div class="control-group"> <label class="control-label">Date</label> <div class="controls"> <div class="control-group input-append date form_datetime"> <date-time-picker data-ng-model="transaction.date"></date-time-picker> </div> </div> </div> <div class="control-group"> <label class="control-label">Amount</label> <div class="controls"> <div class="input-append"> <input type="text" name="transactionAmount" ng-model=

Issue in angular-bootstrap directive while trying to access scope

送分小仙女□ 提交于 2020-01-04 14:14:46
问题 I have used https://github.com/angular-ui/bootstrap for accordion, but with this directive I'm having scope issues. It only allows to use scope if ngController is declared inside of accordion. Please visit below two Plunker links and you will understand what I'm trying to say: Example 1 : http://plnkr.co/edit/Fb4UauWWmHOnTyjMPFBo index.html <!doctype html> <html ng-app="plunker"> <head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script> <script src="//ajax

Issue in angular-bootstrap directive while trying to access scope

心不动则不痛 提交于 2020-01-04 14:14:26
问题 I have used https://github.com/angular-ui/bootstrap for accordion, but with this directive I'm having scope issues. It only allows to use scope if ngController is declared inside of accordion. Please visit below two Plunker links and you will understand what I'm trying to say: Example 1 : http://plnkr.co/edit/Fb4UauWWmHOnTyjMPFBo index.html <!doctype html> <html ng-app="plunker"> <head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script> <script src="//ajax

AngularJS : transclude ng-repeat inside directive

穿精又带淫゛_ 提交于 2020-01-04 11:04:09
问题 I have a directive that transcludes the original content, parses it, and uses the information in the original content to help build the new content. The gist of it looks like this: .directive('list', function() { return { restrict: 'E', transclude: true, templateUrl: '...', scope: true, controller: function($scope, $element, $attrs, $transclude) { var items; $transclude(function(clone) { clone = Array.prototype.slice.call(clone); items = clone .filter(function(node) { return node.nodeType ===

AngularJS : transclude ng-repeat inside directive

瘦欲@ 提交于 2020-01-04 11:03:37
问题 I have a directive that transcludes the original content, parses it, and uses the information in the original content to help build the new content. The gist of it looks like this: .directive('list', function() { return { restrict: 'E', transclude: true, templateUrl: '...', scope: true, controller: function($scope, $element, $attrs, $transclude) { var items; $transclude(function(clone) { clone = Array.prototype.slice.call(clone); items = clone .filter(function(node) { return node.nodeType ===

AngularJs - Server throwing exception''XMLHttpRequest cannot load the “URL” Response for preflight is invalid (redirect)'

谁都会走 提交于 2020-01-04 09:27:11
问题 What is the reason the server is returning object as ' undefined ' and ' XMLHttpRequest cannot load the "URL" Response for preflight is invalid (redirect) . Flow of app - its just a normal post service sending document details to the server in return should return an object holding various parameters, but its returning ' undefined ' The service for posting the document fileUpload: { method: 'POST', url: config.apiPath + 'employee/service/pushRecords', //this is the URL that should return an

AngularJs - Server throwing exception''XMLHttpRequest cannot load the “URL” Response for preflight is invalid (redirect)'

假如想象 提交于 2020-01-04 09:27:06
问题 What is the reason the server is returning object as ' undefined ' and ' XMLHttpRequest cannot load the "URL" Response for preflight is invalid (redirect) . Flow of app - its just a normal post service sending document details to the server in return should return an object holding various parameters, but its returning ' undefined ' The service for posting the document fileUpload: { method: 'POST', url: config.apiPath + 'employee/service/pushRecords', //this is the URL that should return an

How can I place directives in a table?

血红的双手。 提交于 2020-01-04 09:14:07
问题 I'm trying to create a directive inside a table, with angularjs. I can generally get it working, except if I try to put custom elements (in my jsfiddle, <person /> ) inside a table, the browser generally tends to pull it out of the table, and prepend the element. http://jsfiddle.net/drewsonne/WSnyZ/16/ I'm expecting: <div ng-app="MyApp" class="ng-scope"> <people class="ng-scope"> <table> <thead><tr><th>Name</th><th>Age</th></tr></thead> <tbody> <person info="personJohn" class="ng-isolate

How to listen for a site-wide event in a directive with isolate scope

十年热恋 提交于 2020-01-04 04:55:16
问题 I am creating a custom chart widget in angularjs using a directive with isolated scope. The idea being that each widget should be able to exist in isolation after receive basic config information on how to create itself. The widget will communicate with other parts of the application by listening for an "update.data" event. When the event is triggered, the widget knows to refresh its data (Make a call to the server) based on new config information available to it, passed through the event

two way binding on primitive variables in angularjs directive

别说谁变了你拦得住时间么 提交于 2020-01-04 04:37:09
问题 Trying to have 2 way binding on an AngularJS directive while using primitive objects is not working, for example: <custom-directive ng-model="variable"></custom-directive> how can this be achieved? 回答1: In order to have 2 way binding in javascript (not just angularjs), we have to pass an object (this is caused by javascript's evaluation strategy - can read more about it here https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing). basically what is happening is that when we pass a