Tagged Questions
0
votes
0answers
13 views
How can I make a two way binding in AngularJs? Detailed example included
I can't figure this one on my own. Maybe I'm missing something. I have a controller and a directive which creates its own scope.
Plunker link : http://run.plnkr.co/plunks/wFV7d2blZKEXUgHIOxYo/
Here ...
0
votes
1answer
38 views
Angular Directive throws $digest already in progress when trying to call controller method
Here is my plunker - http://plnkr.co/edit/VYH5QbO99ZbMkvc2D4Fe?p=preview
I want to keep the knowledge of controller method outside of directive so used Directive Attribute and pass controller method ...
3
votes
1answer
45 views
Extending directives in AngularJS (sharing properties before and after link)
I have a directive which creates a rich text editor in its LinkingFunction. The small directive I'm using for my rich text editor can be found at ...
0
votes
2answers
41 views
How to set the value of an attribute in Angular?
In my directive I have this code:
// hide all drodowns with this attribute
$(document).find('[dropdown]').each(function (index) {
if ($(this).is(':visible')) {
var a = ...
0
votes
2answers
35 views
Why is angular not updating my model
In my (table) overview I have custom directive. This directive shows customer details and contains an edit button. When this button is clicked a edit form pops up. When I change values of the customer ...
0
votes
0answers
45 views
AngularJS directive - grouping <td> elements
I want to do a directive which appends "grouped" <td> elements based on array in controller,
I try do it like so:
App.directive("discount", ['$compile', ($compile) ->
restrict: 'A'
scope:
...
0
votes
1answer
31 views
Debugging AngularJS Databinding Inline Directive vs Directive in ngTemplate
Take a look at this fiddle: http://jsfiddle.net/ADukg/3036/
I have two directives that are using two-way databinding on a value provided by the same controller instance. When the directives are ...
-1
votes
1answer
26 views
ng-change executing before ng-model is set for a <select>
I have the following html and js
<select ng-change="setBillGroup()" ng-model="bill.groupId" class="span8" ng-options="d.id as d.name for d in groups"></select>
and the corresponding js ...
2
votes
1answer
42 views
Angular.js scope not updating in directive
I have an Angular.js directive that needs an isolate scope plus access to the $parent scope. The parent scope has data which changes after an ajax call completes.
In my directive's linking function, ...
0
votes
1answer
83 views
AngularJS - accessing directive scope
So, I'm looking to use ui.bootstrap.tooltip to appear when an element in a form is invalid.
I'm using a directive to do this - it's a bit ugly, but it works. Except for one thing - the controller ...
0
votes
1answer
42 views
Prepopulating checkbox with content from array?
I have a checkbox which calls a function on ng-click that inserts into a checkedItems array.
How do I prepopulate this checkbox with elements from the checkedItems arrray?
Here are the relevent ...
4
votes
5answers
76 views
AngularJS: how to bind a constant object to a directive
I've created a directive with a binding using "scope". In some cases, I want to bind a constant object. For instance, with HTML:
<div ng-controller="Ctrl">
<greeting person="{firstName: ...
0
votes
0answers
61 views
mouseover event Angular JS access attributes
I have the following directive
courseApp.directive("courseoverview", function() {
function link(scope, element, attrs) {
scope.switched = false;
//hover handler
...
0
votes
2answers
59 views
AngularJS: How do you return variables or modify the $scope from a directive?
I cannot for the life of me get the vars 'start' and 'end' to return to my function in my controller.
l() == console.log()
I'm trying to turn this: ...
0
votes
1answer
41 views
Understanding $watch in AngularJS? [duplicate]
I am a little confused with the $watch syntax in AngularJS.
Given a variable $scope.foo, with initial value of [1,2,3], and update causes it to now equal [1,2]. I want a function to be run whenever ...
1
vote
1answer
122 views
Sharing data between AngularJS controllers? [duplicate]
How do I store the items I've selected in a checkbox with other controllers?
My attempt (see the plnkr for views):
script.js (controllers)
var myApp = angular.module('myApp', []);
...
0
votes
1answer
89 views
Getting select rows from ng-grid?
How do I create (or access) an array of selected rows in my ng-grid?
Documentation (scroll to "Grid options")
id | default value | definition
...
0
votes
2answers
51 views
How to use Twitter typehead.js with Angular compile function?
I am trying to use Twitter's typeahead.js (not the Bootstrap one) along with AngularJS. I can get it all up and running just fine, until I try to get fancy use the custom template and engine options.
...
0
votes
2answers
59 views
AngularJS: Directive scope conflicting with controllers scope
I'm working on a project with AngularJS where I have an issue with 2 scopes conflicting:
- I have controllers defining scopes in different places of my DOM (it works great)
- I just added 3 directives ...
1
vote
2answers
77 views
Access Parent Scope in Transcluded Directive
I would like to access a parent directive's scope, but I can't seem to get the right combination of settings. Is this possible and is it the right approach?
I really want to avoid putting something ...
1
vote
2answers
53 views
How to prevent that a scope is shared among directives n Angular?
All my directives use the sam scope and I want my directives to operate by their own.
Directive:
app.directive('headerSort', function () {
return {
restrict: 'A',
controller: ...
2
votes
1answer
46 views
Angular directives don't work with selects
I can't seem to get selects working with Angular directives! I have two selects, both inside a directive. I would like for the first select to determine the available options for the second select.
...
1
vote
3answers
78 views
Is it Possible to Update Parent Scope from Angular Directive with scope: true?
I have a need for inheriting scope from a parent controller in a directive. I don't necessarily want to leave scope: false. I also don't necessarily want to use an isolated scope, because it ...
0
votes
1answer
58 views
How to implement ng-model binding on this getter/setter scenario?
I have an object exposing 2 properties (say foo and bar) via getters/setters in the form of method([value]), so you can get their value by calling method() and you can set their value by calling ...
1
vote
1answer
35 views
AngularJS: Alerts don't show up when multiple messages change ngModel for message
I have a notification service which works well for when page is loaded and Controller is loaded
But when I have different buttons calling different functions, they change message, but alerts don't ...
2
votes
2answers
124 views
AngularJS custom form validation using $http
I have a form that looks like this:
<form name="myForm" ng-submit="saveDeployment()">
<input type="hidden" value="{{item.CloneUrl}}" name="cloneurl" />
<input type="hidden" ...
0
votes
1answer
48 views
AngularJS combining the use of two custom directives with shared scope
I have two different custom directives, both having an isolated scope. Is there a way to use both directives on the same element without getting:
Error: Multiple directives [...] asking for isolated ...
0
votes
1answer
99 views
AngularJS isolated directive with ng-repeat breaks transclusion scope
I'd really appreciate some understanding of this scoping issue I encountered while developing a transcluded isolated directive, one where the transclusion is repeated inside the template.
I promise ...
0
votes
1answer
49 views
Validation not working (Directive scope.$error is not populated although ng-invalid class is applied to DOM element)
Updated: also, if anyone can tell me how to simplify my code, I would really appreciate that.
In short:
I have simple validation rule applied to element
<div ng-form='myForm'>
<input ...
4
votes
3answers
95 views
Confused about Angularjs transcluded and isolate scopes & bindings
Take your time on this. I won't rush to accept an answer.
I am struggling to understand the scope of models and their bindings in respect of directives which have limited scope.
I get that ...