Questions tagged [javascript-databinding]

This tag is for the application to Javascript of separation-of-concerns approaches such as the Model-View-Controller pattern.

This tag is for the application to JavaScript of separation-of-concerns approaches such as the pattern.

73 questions
41
votes
1 answer

Bind raw html in Aurelia

Using Aurelia, I want to fill an
with contents of viewmodel property (lets call it htmlText) which contains html text, and I was using
${htmlText}
However, this encodes html so, instead of i.e. having paragraph or link, all tags…
Goran Obradovic
  • 8,771
  • 8
  • 47
  • 77
13
votes
2 answers

Two-way data binding to an ngReact component

Using ngReact, how does one elegantly set up a two-way data binding? Let's say I have a simple React input component, which takes a value and fires onChange: angular.module('app', []).value('SimpleInput', props =>
ᆼᆺᆼ
  • 14,442
  • 8
  • 53
  • 87
4
votes
2 answers

How can I prevent Angular from re-sorting my list while editing?

I created a little application using Angular to manage Todolists. Each list has a number of todos. Each todo has attributes name, value1 and value2. Each list should be sorted automatically by Angular, so I used ng-repeat="todo in selectedList.todos…
Timo Ernst
  • 13,291
  • 19
  • 95
  • 153
3
votes
2 answers

Can you use array.filter in an Angular binding?

I have this line in my template: {{ data.things.find(r => { return r.id == 5 }).description }} When I run this, I get the following error: Parser Error: Bindings cannot contain assignments at column... Does this mean you can't use…
Des Horsley
  • 1,759
  • 16
  • 39
3
votes
1 answer

When to use or not use parentheses with observables in data-binding expressions

I have seen other threads on this but I'm still confused and I think I am presenting a different case here. I'm using the revealing pattern to return a view model object to my HTML document. Thus, I have a view model object that looks something like…
Jazimov
  • 10,807
  • 8
  • 45
  • 50
3
votes
1 answer

Creating new line using knockout text

I am creating SPA. I am using knockout and observable array to iterate json array. Sometimes i've got br tag inside text, and using data-bind="text: myVar" I would like to brek line. Problem is, br tags wont work, because i can see
except new…
3
votes
2 answers

Updating skrollr dynamically

I'm looking for a way update the absolute position values of skrollr dynamically. Relative positioning is out of the question as the body tag is the parent element and extends the entire length of the page. The object in question is of fixed…
3
votes
2 answers

ng-bind-html does not work

please look at this fiddle please type 4 in the text area, it should write an error message, that is in this line: $names.push('
'); actually it does not. It prints the html code itself without handling,…
Aladdin Mhemed
  • 3,484
  • 8
  • 37
  • 54
3
votes
2 answers

Multiple use of a form before it is submitted

I'm new to JavaScript, and trying to figure out the canonical way to do the following. I have a form with some checkboxes and a selector. Let's say the checkboxes are styles of music and the selector is for people's names. I'd like the user to be…
OregonTrail
  • 7,245
  • 4
  • 36
  • 53
2
votes
1 answer

How to Handle Recursively Nested Components in RivetsJS?

I currently have a Model that is related back to itself in a parent-child relationship. I need to be able to display these in a tree-like structure on the page (i.e. Nested
  • items). Each
  • item will have an underlying HTML structure that has…
  • swatkins
    • 13,219
    • 4
    • 42
    • 75
    2
    votes
    2 answers

    HTML Select Form Variable Default Value

    I am trying to set a default value for a HTML select form. I've read the posts on setting a constant default value for a select form. However, I want the default value to be the variable shirt.Color, which is either Small, Medium, or Large depending…
    Elaine Lin
    • 371
    • 1
    • 2
    • 15
    2
    votes
    3 answers

    Framework7 with AngularJS data-binding

    Hello I'm new to the Framework7 and I'm trying to use data-binding with AngularJS but I can't seem to get it work. I'm simply trying to bind a name from the controller to my HTML but I guess I'm doing something wrong... Beneath my two pieces of…
    2
    votes
    0 answers

    Will RivetsJS cause memory leaks without calls to unbind

    From the Rivets.js documentation Every call to rivets.bind returns a fully data-bound view that you should hold on to for later. You'll need it in order to unbind its listeners using view.unbind(). But what if it is not convenient to hang on to…
    2
    votes
    0 answers

    $watch not triggering in directive after change in controller

    I have a directive which is basically just a countdown timer. The usage is fairly simple, start counting down whenever the startFlag is true, stop counting when it is false, and call the timeout function when time runs…
    Jeff Lambert
    • 23,036
    • 3
    • 61
    • 88
    2
    votes
    1 answer

    Binding mutually dependent but different data formats to inputs in Angular

    As an exercise, I'm creating inputs for color values using both RGB and hex. html:
    R: G:
    Ben
    • 9,132
    • 8
    • 29
    • 45
    1
    2 3 4 5