Questions tagged [angularjs-model]

The ngModel directive binds an input, select, textarea (or custom form control) to a property on the scope using NgModelController, which is created and exposed by this directive.

From Angularjs documentation:

The ngModel directive binds an input, select, textarea (or custom form control) to a property on the scope using NgModelController, which is created and exposed by this directive.

90 questions
2
votes
2 answers

Directive to load different templates according to the model value received

I'm writing a directive that consists of an inline editor. When there is no value the edit box will appear. When there is value a regular span will appear. This is the template chunk of the directive. template: function (element,attrs) { if (1…
Guillermo
  • 1,493
  • 3
  • 16
  • 35
1
vote
0 answers

What is the difference between scope and model within a directive definition in AngularJS

I was wondering about the difference between scope and model within a directive. The following 2 directives behave exactly the same: angular.module( 'exampleApp', [] ) .directive( 'exampleDirective1', function() { return { restrict: 'E', …
lumio
  • 7,428
  • 4
  • 40
  • 56
1
vote
1 answer

passing value from parent directive to child directive's template function

I'm trying to access value that is passed from the parent's directive on the child directive's template function. Please refer to the below plunker. Plunker Link CODE: Parent Directive: directive('parentDir', function(){ return { controller:…
1
vote
1 answer

AngularJS mantain state when changing views?

Is there a way to maintain $scope when changing views and coming back? When i load a certain view there is some heavy loading (loading data), but if i switch views and comeback to this one al the data is reloading again. Is there a way to prevent…
1
vote
0 answers

Angularjs MV* (MVW) Design Pattern Involving ES6 - AngularJS

I have read these answers by Izhaki and Artem Platonov on Understanding Design Patterns and have some questions about this approach. They might be trivial, but I need some answers. The final answer by Itzhaki made it seem to me that Angularjs design…
1
vote
2 answers

Angular JS get value of date input with ng-model

I try to get the value of my input date html 5 component by binding it with ng-model like this:
Ceddoc
  • 243
  • 3
  • 14
1
vote
2 answers

How to make Angular bind blank inputs to a model?

Here is a simple Angular example:
Vivian River
  • 31,198
  • 62
  • 198
  • 313
1
vote
1 answer
1
vote
2 answers

Angularjs model not updated when switching between users at login

I need the following functionality: When a user goes to the login form, the browser should auto fill the username and password. My implementation works (on FF and Chrome) but, there is this bug (not consistent) where the model data does not get…
1
vote
2 answers

Changing value of an input date picker with button angular

I have have an input field which is attached an Angular UI datepicker. Below that, I added 2 buttons to change date, "day by day". Here is the input part (just after in my page):

Pierolain
  • 189
  • 1
  • 3
  • 18
1
vote
2 answers

How to pass a directive template model to controller / parent scope

Ugh I'm stuck in one of those Angular binds (no pun intended) where I can't get my controller to talk to my directive. My directive is the following, a select dropdown with a template: app.directive('month', function() { return { …
Union find
  • 7,759
  • 13
  • 60
  • 111
1
vote
2 answers

Preserve empty field in model with Angular

If I have an angular form like this
When I access the model it will only hold those fields that have values so if both…
Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96
1
vote
4 answers

Pass function from model into directive in AngularJs

I created one directive in Angularjs now binding model data into directive , problem is that I have I am using JqGrid and I want call one function when JqGrid's gridcomplete event will call. Everything working fine when we direct use function code…
1
vote
2 answers
1
vote
1 answer

Why can't I use Angular an angular directive's $set function to set ngPattern, ngMinlength and ngMaxlength?

This is going to sound weird, but, even if it is bad practice or something, how would I get this: html:
to look like…