GithubHelp home page GithubHelp logo

angular.dart's People

Contributors

akiellor avatar bgourlie avatar blackhc avatar blois avatar cbracken avatar chalin avatar chirayuk avatar codelogic avatar demike avatar igorminar avatar jbdeboer avatar jeffbcross avatar johnvcoleman avatar juliemr avatar justinfagnani avatar kasperl avatar kevmoo avatar matsko avatar mhevery avatar mvuksano avatar naomiblack avatar pavelgj avatar rkirov avatar sethladd avatar technohippy avatar tedsander avatar vicb avatar vojtajina avatar vsavkin avatar yjbanov 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  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

angular.dart's Issues

ng-repeat doesn't work on components

This doesn't work:

<my-component ng-repeat="a in ctrl.aList" a="a"></my-component>

Workaround: wrap component into an outer element, e.g.:

<div ng-repeat="a in ctrl.aList">
  <my-component a="a"></my-component>
</div>

Creating a component directive that renders HTML

Is it expected that something like this should currently work or is there more to it than this:

@NgComponent(
  selector: "simple",
  template: "<div>This is some simple HTML</div>"
)
class SimpleComponent {
  // Do I need to do something here perhaps?
  //Element element;
  //Scope scope;

  //SimpleComponent(Element this.element, Scope this.scope) {
  //}
}

main() {
  var module = new AngularModule()
    ..directive(SimpleComponent);

  bootstrapAngular([module]);
}

I have a <simple></simple> tag in an html file, but nothing happens.

Basically, I'm looking for the Dart equivalent of

app.directive('simple', function() {
  return {
    restrict: "E",
    replace: true,
    template: "<div>This is some simple HTML</div>"
  }
});

Thanks!

Create a private Impl library

Angular.dart should not be exporting internal classes to projects that import Angular.

One solution is to create a private Impl library which the main Angular.dart library imports.

Incorrect cursor behavior in input text field when editing a two-way data bound input

I submitted a bug for fancy-syntax in polymer for this behavior (https://code.google.com/p/dart/issues/detail?id=12475) but I saw the same behavior with angular. A comment on the bug which seems to identify the cause:

"We had a similar bug long time ago in webui, the issue was that we were assigning the value of the text field to the observable variable, and then again back to the text field. This last unnecessary assignment makes the browser loose the cursor position.

(for reference, see https://github.com/dart-lang/web-ui/issues/368, and the fix: https://github.com/dart-lang/web-ui/commit/85cc2a029a9feae87716621660f40d762e8b608f)"

Throw error in parser if reflected object has no property

Angular expressions tend to fail silently, but in dart we can detect things which are clear errors.

a.b -> is fine if a is null
But
a.foo -> is an error if a is a non-null object which does not have a foo proprety and does not have [] operator.

When using $map mode '=' the value should be available in the scope right away

Right now:

class FooComponent {
  static var $map = {
    'bar': '='
  };

  FooComponent(Scope scope) {
    expect(scope.bar, isNull);
    scope.$watch(() => scope.bar, (value) {
      if (value != null) { // watcher will fire with a null the first time.
        // use the value.
      }
    });
  }
}

The value should be available on the scope before the component is instantiated.

Add one-directional setter-based binding

Unlike two-directional binding (=) it won't require the component to maintain the original value or provide a getter for it. Unlike expression binding (&) it will pass the result of calling BoundExpression, not BoundExpression itself.

Use-case: an editor component that modifies a working copy of an object, but only reports the modifications on a specific event, e.g. successful PUT request.

parser: better error when expression calls a non existing function

Eg. <span>{{remaining()}}</span>, if remaining is not defined on the scope, you get:

Exception: Uncaught exception during mirrored execution: <$interpolate error! Can't interpolate: {{remaining()}}
Missing function. 
ORIGINAL STACKTRACE:
 #0      _relaxFnApply (package:angular/angular.dart:75:5)
#1      Parser.parse.<anonymous closure>.<anonymous closure> (package:angular/parser.dart:701:29)
#2      ParsedFn.call (package:angular/parser.dart:11:25)
#3      Interpolate.call.<anonymous closure> (package:angular/interpolate.dart:53:28)
#4      ParsedFn.call (package:angular/parser.dart:11:25)

ORIGINAL STACKTRACE:
 #0      ExceptionHandler.call (package:angular/exception_handler.dart:5:5)
#1      Interpolate.call.<anonymous closure> (package:angular/interpolate.dart:64:28)
#2      ParsedFn.call (package:angular/parser.dart:11:25)
#3      _relaxFnArgs.<anonymous closure> (package:angular/angular.dart:88:16)
#4      Scope.$digest (package:angular/scope.dart:202:39)
#5      bootstrapAngular.<anonymous closure> (http://localhost:8000/demo/todo/main.dart:37:23)
> 

Circular dependency error

class ParentComponent {
  static var $visibility = DirectiveVisibility.CHILDREN;

  ParentComponent(Compiler compiler, Injector injector) {
    var div = new Element.html('<child></child>');
    compiler([div])(injector);
  }
}

class ChildComponent {
  ChildComponent(ParentComponent parent);
}

throws

Cannot resolve a circular dependency! (resolving ParentComponent -> ChildComponent -> ParentComponent)

Which is this case: dart-archive/di.dart#5

Get rid of $

As a dartuser, the use of $ in variable does not look really nice, is there a good reason to keep it?

Cannot pass a function through bindings in angular

Cannot pass a function through bindings in angular. It dumps errors. James has seen the issue.

Current workaround is to use scope to pass the function.

scope['addToItemList'] = (Suggestion suggestion) {
  itemListModel.add(suggestion.value);
};

parser: cannot parse "foo.bar(quaz)"

class Some {
  foo(value) {
    return value;
  }
}

scope['some'] = new Some();
_scope['val'] = true;
_scope['foo'] = (value) {
  return value;
};

dump(parse('foo(val)').getter(scope, {}));
// this will work fine and print expected true

dump(parse('some.foo(val)').getter(_scope, {}));
// this will fail with:
Uncaught exception during mirrored execution: <Compile-time error during mirrored execution: <Object does not implement the List interface> 
ORIGINAL STACKTRACE:
 #0      Injector._getInstanceBySymbol (package:di/injector.dart:91:7)
#1      Injector.getBySymbol (package:di/injector.dart:143:61)
#2      NgControllerAttrDirective.attach (package:angular/directives/ng_controller.dart:28:78)
#3      Block.attach (package:angular/block.dart:253:29)
#4      bootstrapAngular.<anonymous closure> (http://localhost:8000/demo/todo/main.dart:31:46)
>, #0      _LocalClosureMirrorImpl._apply (dart:mirrors-patch/mirrors_impl.dart:291:1)
#1      _LocalClosureMirrorImpl.apply (dart:mirrors-patch/mirrors_impl.dart:268:18)
#2      Injector.invoke (package:di/injector.dart:175:24)
#3      bootstrapAngular (http://localhost:8000/demo/todo/main.dart:30:18)
#4      main (http://localhost:8000/demo/todo/main.dart:55:19)

Text input NgDirective causes cursor to jump to end of input

This refers to @ngdirective(selector: 'input[type=text][ng-model]') in ng_model.dart.

Because the render method unconditionally sets the inputElement.value whenever the model is updated, any keystroke that causes the model to change causes a round-trip from DOM to model and back to DOM again. That last step, updating the DOM, causes the trouble. It becomes nearly impossible for the user to edit any part of the text field other than the end.

This could be solved by implementing render something like:

void render(value) {
  // If the inputElement's value is unconditionally updated, then the cursor
  // gets moved to the end of the input area, even if the value hasn't
  // changed. And it's slow.
  if (inputElement.value != value) {
    inputElement.value = value == null ? '' : value;
  }
}

dart-di dependency in pubspec.yaml

is: [email protected]:mhevery/dart-di.git
should be: git://github.com/mhevery/dart-di.git

fixes:

  • Permission denied (publickey).
  • ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory [in OSX 10.6]

awesome initiative, thanks!

404ing a $templateUrl should produce a readable error

Right now it says:

Uncaught Error: Instance of 'HttpRequestProgressEvent'
Exception: Instance of 'HttpRequestProgressEvent' dart:async/future_impl.dart:180
_FutureImpl._scheduleUnhandledError. dart:async/future_impl.dart:180
_asyncRunCallback._asyncRunCallback dart:async/event_loop.dart:9
_asyncRunCallback._asyncRunCallback dart:async/event_loop.dart:13
Timer.Timer. dart:async-patch/timer_patch.dart:9
_timerFactoryClosure..

parser: cannot set object property

I'm pretty sure this used to work.

class A {
  B b;
  A(B this.b);
}

class B {
  String c;
  B(String this.c);
}

scope['a'] = new A(new B('x'));
parse('a.b.c').assign(scope, 'whatever');
Caught Uncaught exception during mirrored execution: <Class 'A' has no instance method '[]'.

    NoSuchMethodError : method not found: '[]'
    Receiver: Instance of 'A'
    Arguments: ["b"]>
    ORIGINAL STACKTRACE

Incorrect optional parameter argument removal "?"

@pavelgj In block.dart attrAccessorFactory the optional argument operator "?" removal was done incorrectly in #23 since one cannot distinguish "explicitly passed null" from "did not pass an optional argument" parameter. :

attrAccessorFactory(dom.Element element, String name) {
  return ([String value]) {
    if (value != null) {
      if (value == null) { // THIS CODE IS NOW DEAD
        element.removeAttribute(name);
      } else {
        element.setAttribute(name, value);
      }
      return value;
    } else {
      return element.getAttribute(name);
    }
  };
}

In a Google+ thread I saw this suggestion for handling similar problem with a special default value:

class Nothing() { const Nothing(); }
class List {
   List([n = const Nothing()]) { if(identical(n, const Nothing()) { ... } else { ... } }
}

Move MockHttp into lib

Right now MockHttp is in test directory. Need to move it to lib so that it can be used externally.

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.