Giter Site home page Giter Site logo

angular-once's People

Contributors

albyrock87 avatar bobber205 avatar cameronmaske avatar carylandholt avatar egidijusj avatar rafgeekee avatar runxc1 avatar tadeuszwojcik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-once's Issues

Minified version of once.js

While the version is not minified I feel obligated to copy the code to my project(which gets minified on build before deploying).

Having a minified version is always good.

data that never gets defined (once-if and once-show)

<div once-if="thisNeverGetsDefined">
    This will be rendered and not removed
</div>

This is trickier for ng-if, but for ng-show, can you add the ng-hide class name until the data gets defined, then either remove or leave it?

once-if

Should use transclusion instead of letting child elements/directive compiled/rendered.
Had several tests, in the following situation:
<div once-if="a" my-directive></div>
<div once-if="!a" my-directive><div>
both directive still get compiled even though their priority is lower. I suppose the the $element.remove() is queued after the compilation of other directives

Just a question for the code "watcherRemover"

It's not an issue report. Just a clarification request for the code "watcherRemover".
Here are the codes to watch until any defined value is given and then "remove $watch" by invoking removeWatcher(). I am not clear why the $watch will be removed when watcherRemover() is invoked.

// we do not have a valid value, so we register a $watch
var watcherRemover = $scope.$watch(watch, function (newValue) {
  // wait until we have a valid value
  if (newValue == undefined) return;
  // remove this $watch
  removeWatcher();
  // if watching and binding $parsers are the same, use watching's value, else $parse the new value
  return done(element, watcherParser == bindingParser ? newValue : bindingParser($scope));
});

function removeWatcher() {
  if (watcherRemover) {
    watcherRemover();
  }
}

Issue with once-attr-class

The following standard ng-code works as expected:

ng-attr-class="status-{{statusId}}"

I have tried to convert that to once-attr-* syntax:

once once-attr-class="'status-'+'statusId"

However, I get a "string is not a function" error. Anything that I missed?

TypeError: string is not a function
at setOneTimeBinding (once.js:14:25)
at https://localhost/once.js:161:9
at Object.forEach (angular.js:309:20)
at https://localhost/once.js:151:15
at nodeLinkFn (angular.js:6212:13)
at compositeLinkFn (angular.js:5622:15)

use angular.forEach

Older JavaScript engines don't have the forEach method.

Angular provides their own.
This should be used to provide better backward browser compatibility.

Use with $index in ng-repeat

Hey!

Can I use angular-once to set value with $index on a option-element in a ng-repeat?
When I try to add ---once once-attr-value="$index" once-text="HRCvalue"--- I get this error in chrome console: "string is not a function" at "setOneTimeBinding (http://localhost:8100/lib/once.js:14:25)" (only once-text works)

once-attr?

Do you have an idea about how one might go about implementing a once-attr binding? I'm looking to bind to the tooltip attribute required by bootstrap tooltips.

Thanks!

Piping data to a filter

I can't seem to figure out the syntax for this, eg,

Is it possible without the full bind?

angular-once and directive scope parameters

I'd like to use a angular-once with scope parameters.

Suppose I need to pass some value to my directives:

<div ng-repeat="item in items">
    <directive-one ng-if="item.type === 'directive1'" value="{{item.value}}"></directive-one>
    <directive-two ng-if="item.type === 'directive2'" value="{{item.value}}"></directive-two>
</div>

app.directive('directiveOne', function() {
  return {
    scope: {
      value: '@'
    },
    restrict: 'E',
    template: '<p once-text="value"></p>'
  }
});

This will setup a watch using {{item.value}} and scope: value. How can I avoid it?

Thanks!

once-src issue

Hi,

I'm using once-src like so:

<img once-src="http://foo.com/image/{{ model.id }}/?size=200" />

But the directive doesn't work and spits out something like this :

<img once-src="http://foo.com/image/{{ model.id }}/?size=200" src="http://foo.com/image//?size=200" />

I've investigated a little, and it seems that when we arrive in the linking function, attrs['onceSrc'] is already interpolated to http://foo.com/image//?size=200.
Your check in setOneTimeBinding then fails since value is not undefined.

I suppose this issue will apply to all interpolated values.

Cheers

Refreshing anglar-once bindings in certain cases

I think it would be useful in some cases to update content that has been bound-once. For example, if you change the locale of an app. In this case you'd want all of the bound-once content to update.

I've been watching @Pasvaz's bindonce rebind-debug branch and it's a nice feature, but it looks like that project is slowing down a bit. Perhaps because of ngBindOnce coming in 1.3? The problem is that ngBindOnce doesn't have this feature either.

Do you think it's something that could go into angular-once?

input once-attr-name creating strange name attribute

I expected

<input type="radio" once once-attr-name="'question-' + question.id" />
<input type="radio" once once-attr-name="'question-' + question.id" />
<input type="radio" once once-attr-name="'question-' + question.id" />

to result in

<input type="radio" name="question-1" />
<input type="radio" name="question-1" />
<input type="radio" name="question-1" />

but I get

<input type="radio" name="05T" />
<input type="radio" name="05W" />
<input type="radio" name="05Z" />

once-if not working inside ng-repeat

First of all wants to thank for this plugin. My page have lots of read only data which is rendered once. It helped me to reduce no of watches. I am still working on it to reduce more.

A small bug i found is if i use ng-if within ng-repeat then it works but not once-if. Without ng-repeat once-if works perfectly. Need help to fix it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.