Code Monkey home page Code Monkey logo

angular's Introduction

angular's People

Contributors

alorenzen avatar benasocj avatar chalin avatar davidmorgan avatar dramos07 avatar ferhatb avatar gresrun avatar grouma avatar harryterkelsen avatar iinozemtsev avatar irfantusneem avatar jakemac53 avatar jbdeboer avatar keertip avatar kevmoo avatar kwalrath avatar leafpetersen avatar leonsenft avatar liuming0 avatar maopanglin avatar matanlurey avatar michaelrfairhurst avatar natebosch avatar rkj avatar srawlins avatar stereotype441 avatar tedsander avatar thso avatar tijoforyou avatar vsmenon 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular's Issues

Remove "library" tags from Dart code.

As mentioned in other dart libraries:

We no longer recommend that developers write an explicit library tag - a default tag is generated for you using the path/filename and is guaranteed to be unique.

Dependency issue between angular2_testing and angular2 beta.18 or higher.

Looks like angular2_testing is not upgraded. And the code is deleted from the repository.
On upgrading angular2 to beta.18 or higher, pub can't resolve the dependency with angular2_testing.
So I'm hesitating to test and upgrade my public/private code with latest angular2.

I'd appreciate knowing the plan of angular2_testing to be upgraded, or perhaps deprecated or migrated to angular2?

[bug] Pure pipes treated like impure pipes re. list values

Expected/desired behavior

See the Flying Heroes (pure pipe) example:

  • Type in a hero name like "Birdman" and hit enter.

Since "can fly" and "mutate array" are selected, a new flying hero will be added to the existing hero list.

Since a pure pipe is used here, we should see "Birdman" appear in the All Heroes list, but NOT the Heroes who fly list.

This correct behavior was present up until beta.15. No statements can be made about beta.16 and beta.17 because pipes were broken (cf. angular/angular#8258).

Current behavior

"Birdman" appears in both lists, as if the pipe were impure.

Reproduction of the problem

Instructions are given above.

  • Angular2 Dart version: beta.18
  • Browser: tested on Chrome.

cc @kwalrath

Support using resolved ASTs for code generation

Lots of optimizations to the compiler, better static error checking, and further feature enhancement to Angular Dart will require that we use fully resolved ASTs, not just the raw ASTs, for code generation.

Considering this is a blocking issue to many of the issues logged today.

Clarify which docs people should look at

The README should clearly point people to the docs at angular.io/dart.

Also, we should clarify everywhere people might end up when looking for these docs. E.g., when you go to https://pub.dartlang.org/packages/angular2, you see the following links:

CSP issue

I´m just trying to create a chrome extension with angular 2 and this exception was thrown.
Exception: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource:".

The null object does not have a method 'visitExpression'

Overview: When running pub build, compilation fails while compiling templates. Looking at the stack trace, it appears that the error occurs when visiting a return statement. For some reason, the AST's representation of the statement has a null value. Here is the stack trace:

Working dir: /Users/tobe/WebstormProjects/proxy-dispenser
/usr/local/opt/dart/libexec/bin/pub build --mode=release --output=build
Loading source assets...
Loading dart_to_js_script_rewriter, angular2/transform/codegen, observe and smoke/src/default_transformer transformers...
Loading angular2 transformers...
Building angel...
Build error:
Transform TemplateCompiler on angel|web/main.ng_meta.json threw error: The null object does not have a method 'visitExpression'.

NoSuchMethodError: method not found: 'visitExpression'
Receiver: null
Arguments: [Instance of '_DartEmitterVisitor', Instance of 'EmitterVisitorContext']
dart:core-patch/object_patch.dart 44                                              Object._noSuchMethod
dart:core-patch/object_patch.dart 47                                              Object.noSuchMethod
package:angular2/src/compiler/output/abstract_emitter.dart 131:16                 AbstractEmitterVisitor.visitReturnStmt
package:angular2/src/compiler/output/output_ast.dart 570:20                       ReturnStatement.visitStatement
package:angular2/src/compiler/output/abstract_emitter.dart 469:19                 AbstractEmitterVisitor.visitAllStatements.<fn>
dart:core-patch/growable_array.dart 258                                           List.forEach
package:angular2/src/compiler/output/abstract_emitter.dart 468:16                 AbstractEmitterVisitor.visitAllStatements
package:angular2/src/compiler/output/dart_emitter.dart 187:10                     _DartEmitterVisitor._visitClassMethod
package:angular2/src/compiler/output/dart_emitter.dart 122:43                     _DartEmitterVisitor.visitDeclareClassStmt.<fn>
dart:core-patch/growable_array.dart 258                                           List.forEach
package:angular2/src/compiler/output/dart_emitter.dart 122:18                     _DartEmitterVisitor.visitDeclareClassStmt
package:angular2/src/compiler/output/output_ast.dart 631:20                       ClassStmt.visitStatement
package:angular2/src/compiler/output/abstract_emitter.dart 469:19                 AbstractEmitterVisitor.visitAllStatements.<fn>
dart:core-patch/growable_array.dart 258                                           List.forEach
package:angular2/src/compiler/output/abstract_emitter.dart 468:16                 AbstractEmitterVisitor.visitAllStatements
package:angular2/src/compiler/output/dart_emitter.dart 53:15                      DartEmitter.emitStatements
package:angular2/src/compiler/offline_compiler.dart 143:14                        OfflineCompiler._codegenSourceModule
package:angular2/src/compiler/offline_compiler.dart 106:12                        OfflineCompiler.compile
package:angular2/src/transform/template_compiler/generator.dart 57:29             processTemplates.<async>.<fn>
package:angular2/src/transform/common/logging.dart 37:27                          logElapsedSync
package:angular2/src/transform/template_compiler/generator.dart 56:29             processTemplates.<async>
dart:async-patch/async_patch.dart 27                                              _asyncThenWrapperHelper.<fn>
dart:async/zone.dart 1158                                                         _rootRunUnary
dart:async/zone.dart 1037                                                         _CustomZone.runUnary
dart:async/future_impl.dart 131                                                   _FutureListener.handleValue
dart:async/future_impl.dart 637                                                   _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 667                                                   _Future._propagateToListeners
dart:async/future_impl.dart 467                                                   _Future._complete
dart:async/future_impl.dart 52                                                    _SyncCompleter.complete
package:angular2/src/transform/common/logging.dart 27:3                           logElapsedAsync.<async>
dart:async-patch/async_patch.dart 27                                              _asyncThenWrapperHelper.<fn>
dart:async/zone.dart 1158                                                         _rootRunUnary
dart:async/zone.dart 1037                                                         _CustomZone.runUnary
dart:async/future_impl.dart 131                                                   _FutureListener.handleValue
dart:async/future_impl.dart 637                                                   _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 667                                                   _Future._propagateToListeners
dart:async/future_impl.dart 467                                                   _Future._complete
dart:async/future_impl.dart 52                                                    _SyncCompleter.complete
package:angular2/src/transform/template_compiler/compile_data_creator.dart 121:5  _CompileDataCreator.createCompileData.<async>
dart:async-patch/async_patch.dart 27                                              _asyncThenWrapperHelper.<fn>
dart:async/zone.dart 1158                                                         _rootRunUnary
dart:async/zone.dart 1037                                                         _CustomZone.runUnary
dart:async/future_impl.dart 131                                                   _FutureListener.handleValue
dart:async/future_impl.dart 637                                                   _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 667                                                   _Future._propagateToListeners
dart:async/future_impl.dart 467                                                   _Future._complete
dart:async/future_impl.dart 52                                                    _SyncCompleter.complete
package:angular2/src/transform/template_compiler/compile_data_creator.dart 268:5  _CompileDataCreator._extractNgMeta.<async>
dart:async-patch/async_patch.dart 27                                              _asyncThenWrapperHelper.<fn>
dart:async/zone.dart 1158                                                         _rootRunUnary
dart:async/zone.dart 1037                                                         _CustomZone.runUnary
dart:async/future_impl.dart 131                                                   _FutureListener.handleValue
dart:async/future_impl.dart 637                                                   _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 667                                                   _Future._propagateToListeners
dart:async/future_impl.dart 485                                                   _Future._completeError
dart:async/future_impl.dart 537                                                   _Future._asyncCompleteError.<fn>
dart:async/zone.dart 1150                                                         _rootRun
dart:async/zone.dart 1026                                                         _CustomZone.run
dart:async/zone.dart 953                                                          _CustomZone.bindCallback.<fn>
dart:async/schedule_microtask.dart 41                                             _microtaskLoop
dart:async/schedule_microtask.dart 50                                             _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 96                                          _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 149                                         _RawReceivePortImpl._handleMessage

dart:core                                                                         Object.noSuchMethod
package:angular2/src/compiler/output/abstract_emitter.dart 131:16                 AbstractEmitterVisitor.visitReturnStmt
package:angular2/src/compiler/output/output_ast.dart 570:20                       ReturnStatement.visitStatement
package:angular2/src/compiler/output/abstract_emitter.dart 469:19                 AbstractEmitterVisitor.visitAllStatements.<fn>
dart:core                                                                         List.forEach
package:angular2/src/compiler/output/abstract_emitter.dart 468:16                 AbstractEmitterVisitor.visitAllStatements
package:angular2/src/compiler/output/dart_emitter.dart 187:10                     _DartEmitterVisitor._visitClassMethod
package:angular2/src/compiler/output/dart_emitter.dart 122:43                     _DartEmitterVisitor.visitDeclareClassStmt.<fn>
dart:core                                                                         List.forEach
package:angular2/src/compiler/output/dart_emitter.dart 122:18                     _DartEmitterVisitor.visitDeclareClassStmt
package:angular2/src/compiler/output/output_ast.dart 631:20                       ClassStmt.visitStatement
package:angular2/src/compiler/output/abstract_emitter.dart 469:19                 AbstractEmitterVisitor.visitAllStatements.<fn>
dart:core                                                                         List.forEach
package:angular2/src/compiler/output/abstract_emitter.dart 468:16                 AbstractEmitterVisitor.visitAllStatements
package:angular2/src/compiler/output/dart_emitter.dart 53:15                      DartEmitter.emitStatements
package:angular2/src/compiler/offline_compiler.dart 143:14                        OfflineCompiler._codegenSourceModule
package:angular2/src/compiler/offline_compiler.dart 106:12                        OfflineCompiler.compile
package:angular2/src/transform/template_compiler/generator.dart 57:29             processTemplates.<async>.<fn>
package:angular2/src/transform/common/logging.dart 37:27                          logElapsedSync
package:angular2/src/transform/template_compiler/generator.dart 56:29             processTemplates.<async>
dart:async                                                                        _SyncCompleter.complete
package:angular2/src/transform/common/logging.dart 27:3                           logElapsedAsync.<async>
dart:async                                                                        _SyncCompleter.complete
package:angular2/src/transform/template_compiler/compile_data_creator.dart 121:5  _CompileDataCreator.createCompileData.<async>
dart:async                                                                        _SyncCompleter.complete
package:angular2/src/transform/template_compiler/compile_data_creator.dart 268:5  _CompileDataCreator._extractNgMeta.<async>
[Info from Dart2JS]:
Compiling angel|web/main.dart...
[Error from Dart2JS]:
web/main.dart:3:1:
Can't read 'file:///Users/tobe/WebstormProjects/proxy-dispenser/web/main.template.dart' (Could not find asset angel|web/main.template.dart.).
import 'main.template.dart' as ngStaticInit;import "dart:convert" show JSON;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Warning from Dart2JS]:
web/main.dart:26:135:
'ngStaticInit' has no member named 'initReflector'.
  bootstrapStatic(ProxyAppComponent, [ROUTER_PROVIDERS, provide(LocationStrategy, useClass: HashLocationStrategy), UserService], () { ngStaticInit.initReflector(); });
                                                                                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Build failed.
[Info from Dart2JS]:
Took 0:00:06.025756 to compile angel|web/main.dart.
Process finished with exit code 65

And the code that ostensibly causes it:

dynamic visitReturnStmt(o.ReturnStatement stmt, dynamic context) {
  EmitterVisitorContext ctx = context;
  ctx.print('''return ''');

  // stmt.value is null!!!
  stmt.value.visitExpression(this, ctx);
  ctx.println(";");
  return null;
}

Angular Version: Occurs in 2.0.0-beta.18 and 2.0.0-beta.20. I haven't tried this in other versions.

Motivation: I am trying to launch an app, and I cannot launch it if the source cannot be compiled to JS. 😢

Browsers: N/A

Reproduce the Error: I am not sure. All I did was run pub build.

Related Issues: None

Suggest a Fix: Not yet sure what's causing this, so I have no suggestions.

Thanks in advance. Also, if there is any way I can contribute to Dart or any of these projects, I would very much enjoy it. I have made some cool packages with Dart, and am working on a Web server framework. In fact, this project uses it.

Best wishes!

In beta.21 I get an error about a missing entry points configured in a dependency

Pub Serve terminated
/usr/local/bin/dart/dart-sdk/bin/pub serve test --port=42943
Loading source assets...
Loading sass, angular2 and dart_to_js_script_rewriter transformers...
The value "web/index.dart" in "entry_points" of the Angular 2 transformer configuration does not point to any file.
Error on line 24, column 5 of ../../../contributing/ng_bootstrap/pubspec.yaml: Error loading transformer: Directory listing failed, path = './web/components/accordion/' (OS Error: No such file or directory, errno = 2)
    platform_directives:
    ^^^^^^^^^^^^^^^^^^^^^
Pub Serve terminated

pubspec.yaml

dependencies:
  angular2: ^2.0.0-beta.19
  bootstrap_sass: 4.0.0-alpha.2
  browser: ^0.10.0+2
  http: ^0.11.3+9
  meta: '^1.0.1'
  ng_bootstrap: #^0.1.0
    path: ../../../contributing/ng_bootstrap

transformers:
- sass
- angular2:
    mirror_mode: verbose
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points:
    - web/main.dart
    - test/webui/primitive_value_input/string_input_test.dart
    resolved_identifiers:
        BrowserClient: 'package:http/browser_client.dart'
...

I don't get why the Angular2 transformer reads entry_points from a dependency.

passing closure to polymer.dart element fails in beta19, worked in previous versions

i am using polymer.dart and angular 2 together in a project.

i have a polymer element to which i pass a closure from my angular2 element like so:

<data-list
...
[contextMenuItems]="addressBookData.getContextMenuItems"
...

this used to work up until beta18.

in beta19 i am getting the following exception:

ORIGINAL EXCEPTION:
Invalid argument(s): Attempt to pass Function 'Closure: (dynamic) => List from Function 'getContextMenuItems':.' to JavaScript via without calling allowInterop or allowInteropCaptureThis
ORIGINAL STACKTRACE:

#0      safeForTypedInterop (dart:js:1471)
#1      ngSetProperty (package:angular2/src/platform/browser/browser_adapter.dart_js_interop_patch.dart:31:3)
#2      BrowserDomAdapter.setProperty (package:angular2/src/platform/browser/browser_adapter.dart:180:7)
#3      DomRenderer.setElementProperty (package:angular2/src/platform/dom/dom_renderer.dart:194:9)
#4      _View_NgAddressBookList0.detectChangesInternal (package:direkt_web/views/client/address/ngaddressbook_list.template.dart:322:21)
#5      AppView.detectChanges (package:angular2/src/core/linker/view.dart:245:10)
#6      DebugAppView.detectChanges (package:angular2/src/core/linker/view.dart:366:26)
#7      AppView.detectViewChildrenChanges (package:angular2/src/core/linker/view.dart:269:23)
#8      _View_NgAddressBookList_Host0.detectChangesInternal (package:direkt_web/views/client/address/ngaddressbook_list.template.dart:441:10)
#9      AppView.detectChanges (package:angular2/src/core/linker/view.dart:245:10)
#10     DebugAppView.detectChanges (package:angular2/src/core/linker/view.dart:366:26)
#11     AppView.detectContentChildrenChanges (package:angular2/src/core/linker/view.dart:262:31)
#12     _View_MainApp0.detectChangesInternal (package:direkt_web/main_app.template.dart:335:10)
#13     AppView.detectChanges (package:angular2/src/core/linker/view.dart:245:10)
#14     DebugAppView.detectChanges (package:angular2/src/core/linker/view.dart:366:26)
#15     AppView.detectViewChildrenChanges (package:angular2/src/core/linker/view.dart:269:23)
#16     _View_MainApp_Host0.detectChangesInternal (package:direkt_web/main_app.template.dart:1087:10)
#17     AppView.detectChanges (package:angular2/src/core/linker/view.dart:245:10)
#18     DebugAppView.detectChanges (package:angular2/src/core/linker/view.dart:366:26)
#19     ViewRef_.detectChanges (package:angular2/src/core/linker/view_ref.dart:99:11)
#20     ApplicationRef_.tick.<anonymous closure> (package:angular2/src/core/application_ref.dart:443:63)
#21     List.forEach (dart:core-patch/growable_array.dart:254)
#22     ApplicationRef_.tick (package:angular2/src/core/application_ref.dart:443:32)
#23     ApplicationRef_.ApplicationRef_.<anonymous closure>.<anonymous closure> (package:angular2/src/core/application_ref.dart:326:14)
#24     _rootRun (dart:async/zone.dart:895)
#25     _ZoneDelegate.run (dart:async/zone.dart:490)
#26     NgZoneImpl._run (package:angular2/src/core/zone/ng_zone_impl.dart:155:21)
#27     _CustomZone.run (dart:async/zone.dart:790)
#28     NgZoneImpl.runInner (package:angular2/src/core/zone/ng_zone_impl.dart:126:23)
#29     NgZone.run (package:angular2/src/core/zone/ng_zone.dart:220:27)
#30     ApplicationRef_.ApplicationRef_.<anonymous closure> (package:angular2/src/core/application_ref.dart:325:18)
#31     _RootZone.runUnaryGuarded (dart:async/zone.dart:1075)
#32     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#33     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#34     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:381)
#35     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:256)
#36     EventEmitter.emit (package:angular2/src/facade/async.dart:94:17)
#37     NgZone._checkStable (package:angular2/src/core/zone/ng_zone.dart:145:34)
#38     NgZone.NgZone.<anonymous closure> (package:angular2/src/core/zone/ng_zone.dart:128:16)
#39     NgZoneImpl._run (package:angular2/src/core/zone/ng_zone_impl.dart:157:14)
#40     _CustomZone.run (dart:async/zone.dart:790)
#41     _CustomZone.runGuarded (dart:async/zone.dart:696)
#42     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#43     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#44     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#45     _ScheduleImmediateHelper._handleMutation (dart:html:49290)

Deprecate: facade/async.dart#EventEmitter

EventEmitter should be marked @Deprecated(...) as it only existed to merge JS/Dart world.

Functionally, an EventEmitter is a StreamController, except that it implements the Stream interface to save you the controller.stream call, but also exposes the controller to listeners if they cast, which seems at best, ugly.

Timeline is to mark '@deprecated()` for a release, and then remove in a future release. We don't have any SLA's around this API, and it should be fairly easy for clients to update since it's just a wrapper API. We won't remove until all internal code is cleaned up, which will take a bit anyway.

b21: Creating style elements for ViewEncapsulation.Native

Prior to b21 every style elements was created with DOM.createStyleElement but with b21 for ViewEncapsulation.Native it creates with AppView.createStyleElement that simple uses document.createElement('STYLE').

I am using Angular and Polymer together so in my application I need to use document.createElement('STYLE', 'custom-style'). I'm extends from BrowserDomAdapter and override createStyleElement with this logic. But now it is working only for ViewEncapsulation.Emulated and ViewEncapsulation.None.

It is possible to override AppView and use custom or maby in AppView.createStyleElement you can use DOM.createStyleElement insted of call to document.createElement?

Angular Dart transformer silently ignores `entry_points` files that do not exist

Consider the following excerpt from a pubspec.yaml:

...
transformers:
- angular2:
    platform_directives: ...
    platform_pipes: ...
    entry_points: SOME/FILE_DOES_NOT_EXIST.dart

Current behavior
Running pub serve reports no error (but then fails to identify target types for static code generation), and so the app usually fails later down the road.

Expected/desired behavior
It would be nice if the transformer would at least report an error or warning if the entry_points do not exist.

  • Angular version: 2.0.0-beta.17
  • Browser: Chrome 50 | Chromium 45
  • Language: Dart

Migrated from angular/angular#8897.

Add a CHANGELOG.md file

It's unclear what changed (aside from the innards) between b17 & b18. For future releases, a CHANGELOG.md file would help.

di: Provider with useValue doesn't accept const complex data type instances

In beta 18, declaring a Provider with useValue currently fails in the angular transfomer if you use an instance of a complex data type.

For example, use the following setup to define a component:

class Bar {
   const Bar();
}

@Component(
    selector: 'foo',
    template: '<div></div>',
    providers: const [const Provider(DisplayOptions, useValue: const Bar())]
)
class Foo {
}

This throws Invalid argument(s): Incorrect identifier "const Bar()"

And the stack trace is:

package:angular2/src/transform/common/type_metadata_reader.dart 1357:7   _readIdentifier
package:angular2/src/transform/common/type_metadata_reader.dart 1375:12  _readValue
package:angular2/src/transform/common/type_metadata_reader.dart 1166:20  _readProvider.<fn>

b21: dart:js_util dependecy exception

After upgrading to b21, running the app in Dartium, the console reads:

The requested built-in library is not available on Dartium.'package:angular2/src/platform/browser/browser_adapter.dart': error: line 5 pos 1: library handler failed
import 'dart:js_util' as js_util;
^: package:angular2/src/platform/browser/browser_adapter.dart

Angular RC-18 transformer cannot coexist with Polymer RC-18 transformer

Not sure whose issue this really is, but it was with the new release of Angular that the problem appeared. In a new Angular 2 project on Windows 10 and Dart SDK 1.17.1, with a pubspec like so:

dependencies:
  angular2: 2.0.0-beta.18
  polymer: ^1.0.0-rc.18
  web_components: ^0.12.0
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
transformers:
- polymer:
    entry_points: web/index.html
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
- dart_to_js_script_rewriter

A build error will occur. Pub Serve reports:

Build error:
Transform WebComponents on test_angular|web/index.html threw error: Invalid argument(s): Illegal character in path
dart:core/uri.dart 861                                  Uri._checkWindowsPathReservedCharacters
dart:core/uri.dart 962                                  Uri._makeWindowsFileUrl
dart:core/uri.dart 744                                  Uri.Uri.file
package:analyzer/src/string_source.dart 30:45           StringSource.StringSource
package:dart_style/src/dart_formatter.dart 81:28        DartFormatter.formatSource
package:dart_style/src/dart_formatter.dart 62:12        DartFormatter.format
package:initialize/transformer.dart 340:32              _BootstrapFileBuilder._buildNewEntryPoint
package:initialize/transformer.dart 225:49              _BootstrapFileBuilder.run
package:initialize/transformer.dart 37:8                generateBootstrapFile
package:web_components/build/web_components.dart 32:29  generateWebComponentsBootstrap
package:web_components/build/web_components.dart 82:25  WebComponentsTransformer.apply.<fn>.<fn>
dart:async/zone.dart 1204                               _RootZone.runUnary
dart:async/future_impl.dart 131                         _FutureListener.handleValue
dart:async/future_impl.dart 637                         _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 667                         _Future._propagateToListeners
dart:async/future_impl.dart 477                         _Future._completeWithValue
dart:async/future_impl.dart 528                         _Future._asyncComplete.<fn>
dart:async/schedule_microtask.dart 41                   _microtaskLoop
dart:async/schedule_microtask.dart 50                   _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 96                _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 149               _RawReceivePortImpl._handleMessage

With Angular RC-17, this is not a problem.

Remove the need to keep implementing life cycle classes on subclasses

Currently you can extend existing components or directives, but in order for the life cycle hooks to trigger, the subclass must always copy the 'implements' list.

i.e.

@Component()
class Foo implements OnDestroy {
    void ngOnDestroy() => 'do something';
}
@Component()
class Bar extends Foo implements OnDestroy {
    // ngOnDestroy is called
}
@Component()
class Baz extends Foo {
    // ngOnDestroy is not called
}

Bar need to declare that it imlpements OnDestroy, or the ngOnDestroy method is not called.

I've always assumed that this was a downside from the compile-from-TS solution, is there any chance this can be adjusted? (ending up with the Baz class instead of the Bar class)

Exception is thrown when upgrading to latest master

EXCEPTION: Symbol("AppComponent") implements interfaces but does not declare them: Symbol("AfterContentChecked"), Symbol("AfterContentInit"), Symbol("AfterViewChecked"), Symbol("AfterViewInit"), Symbol("DoCheck"), Symbol("OnChanges"), Symbol("OnDestroy"), Symbol("OnInit"). See https://goo.gl/b07Kii for more info.

Add `ngOutletContext` attribute to `NgTemplateOutlet` similar to TS

Please add ngOutletContext attribute to NgTemplateOutlet.

In TS version you can see how this attribute is being implemented:

https://github.com/angular/angular/blob/2.0.0-rc.5/modules/%40angular/common/src/directives/ng_template_outlet.ts#L38

this attribute allows to change the context of the outlet, which allows to use the component internal scope
instead the scope of the current component

<template [ngTemplateOutlet]="templateRefExpression"
          [ngOutletContext]="objectExpression">
</template>

I already create a similar directive into ng_bootstrap, this directive is BsTemplateOutlet you can find the source code here:

https://github.com/dart-league/ng_bootstrap/blob/develop/lib/components/template_outlet/bs_template_outlet.dart

Recover cheatsheet sources

Cheatsheet sources (*.md files) used to be under docs/cheatsheet, but this folder no longer exists. Without this we can't build the cheatsheet for angular.io/dart.

cc @kwalrath

Failing test test/core/debug/debug_node_test.dart: debug element should list all child nodes

at 61a4a50 – seems related to whitespace, maybe?

01:12 +1019 -1: [Dartium Content Shell] test/core/debug/debug_node_test.dart: debug element should list all child nodes
  Expected: <3>
    Actual: <5>

  package:test                                               expect
  debug_node_test.dart 202:11                                main.<fn>.<fn>.<async>.<fn>.<fn>
  ===== asynchronous gap ===========================
  dart:async                                                 _Future.then
  debug_node_test.dart 199:37                                main.<fn>.<fn>.<async>.<fn>
  dart:core                                                  Function.apply
  package:angular2/src/testing/internal_injector.dart 84:21  FunctionWithParamTokens.execute
  package:angular2/src/testing/internal_injector.dart 55:15  TestInjector.execute
  package:angular2/src/testing/internal.dart 52:17           inject.<async>
  ===== asynchronous gap ===========================
  dart:async                                                 Future.Future.microtask
  package:angular2/src/testing/internal.dart                 inject
  debug_node_test.dart 197:14                                main.<fn>.<fn>.<async>
  ===== asynchronous gap ===========================
  dart:async                                                 Future.Future.microtask
  debug_node_test.dart                                       main.<fn>.<fn>

Add null coalescing operator (??) in template expressions

Dart needs a way to handle null values in template expression like the || operator in JS.
The elvis operator (?.) doesn't help in situations like selectedValue != null ? selectedValue : 'no selection'.
Since dart got the support for the ?? operator in 1.12, I think it should be a part of template expressions.

(copy of issue angular/angular#6367 in the old project)

Support [class] property (workaround is [className])

From @kwalrath on February 5, 2016 0:0

If you use [className] instead, it works.

Misko says, "We alias [class] to [className] so it looks like the alias is broken in Dart."

Example:

// In Dart code:
class AppComponent {
  //...
  String badCurly = 'bad curly'; // Works with [className].
  //...
}

<!-- In HTML: -->
<div class="bad curly special">Bad curly special</div>

<!-- reset/override all class names with a binding  -->
<div class="bad curly special"
     [className]="badCurly">Bad curly</div>

If you change [className] to [class], it stops working.

See the whole sample in angular/angular.io#758. It's based on the TypeScript Template Syntax page, which has a plunkr for its sample.

Copied from original issue: angular/angular#6901

Extracting DI as a lib

I was wondering, if extracting the new DI engine would be a possible/good thing to do.

Right now, the only good DI lib we have in Dart is di.dart, that seems to be lowly maintained. Is this new version better than the old one?

I'd very much like to use this for redstone instead of the old one if it's better, and if it's possible at all.

Thanks!

CSS @import not behaving as documented

Update: this is still an issue with 3.0.0. I've updated the text below and added a link to sources that can be used to reproduce the issue.


The Dart equivalent of the Dev Guide Component Styles example, doesn't behave like its TS counterpart when it comes to CSS @imports.

Steps to reproduce and a minimal demo of the problem

Get the component-styles example project. Relevant files are:

  • lib/hero_details_componet.dart:
@Component(
    selector: 'hero-details',
    template: ...,
    styleUrls: const ['hero_details_component.css'],   /*<<<<<<<*/
    directives: const [HeroTeamComponent])
class HeroDetailsComponent {
  @Input() Hero hero;
}
  • lib/hero_details_component.css (excerpt):
/* Causes an ERROR:*/ @import 'hero_details_box.css';  /*<<<<<<<*/
:host {
  display: block;
  border: 1px solid black;
}
...
  • lib/hero_details_box.css
:host { padding: 10px; }
h2::after { content: " (from imported CSS)"; }

Current behavior

The @import line in lib/hero_details_component.css is currently commented out. If you uncomment the line (and remove the space between the @ and the import tokens), and do a pub serve or pub build then you'll get an error:

Building component_styles...
Build error:
Transform StylesheetCompiler on component_styles|lib/hero_details_component.css threw error: Url component_styles|lib/hero_details_component.css.dart is not a valid asset: url

Replacing the @import argument with any relative path results in the same error.

If you copy lib/hero_details_box.css into the project's web folder and change the @import argument to an absolute path like:

@import '/hero_details_box.css';

then the normal CSS selectors work, but :host styling doesn't.

Expected/desired behavior

According to the Dev Guide Component Styles, CSS @imports subsection:

We can also import CSS files into our CSS files by using the standard CSS @import rule.
In this case the URL is relative to the CSS file into which we are importing.

Other information

This was tested with beta.17. Possibly related (but different) issues:

Migrated from angular/angular#8518.

OnDeactivate not called on browser tab closing.

I'm using routing and everything seems to work fine.
I have a function that store same data on an external Db when a certain component is deactivated.
This works good when I'm moving to another route, but, If I close the browser, it is not called.
Now I don't know if this is by design or if it should be considered a bug.
If not a bug, may you please give an hint on how to avoid this problem?

angular 2 and polymer dart

it seems that angular 2 switched from dart:js to package:js with version beta.19.
polymer dart still seems to use dart:js.

not surprisingely, this breaks angular2 <-> polymer interop in many ways.

Exception: Cannot find reflection information on SomeClass

Migrated from angular/angular#9673 (comment).

Current behavior

Setup for use of the Angular http library is straightforward in ng2/ts as can be see from this excerpt of app/main.ts (v1) taken from the HTTP dev guide chapter:

import { bootstrap }      from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import { AppComponent }   from './app.component';

bootstrap(AppComponent, [ HTTP_PROVIDERS ]);

Namely, one can simply add [ HTTP_PROVIDERS ] as second argument to bootstrap().

Expected/desired behavior

One would expect that a similar setup should be just as easy to do in ng2/dart; here is web/main.dart (v1) excerpt from here:

import 'package:angular2/platform/browser.dart';
import 'package:http/browser_client.dart';
import 'package:server_communication/app_component.dart';

void main() { bootstrap(AppComponent, const [BrowserClient]); }

Attempting to run the dart code above results in the app failing and following is being reported in the Dartium console:

Exception: Cannot find reflection information on BrowserClient.

Others report similar problems when running apps (compiled to js) under Chrome: see this SO post.

Reproduction of the problem

The simplest example I could come up with to reproduce this exception can be created as follows:

  • Launch WebStorm.
  • Create a new Dart Angular 2 web project.
  • Open main.dart and add the following as a second argument to bootstrap():
    [Object]
    (use or not of const does not seem to be pertinent here).
  • Then launch the app (in Dartium) and open the JS console. The app should fail to load and "Exception: Cannot find reflection information on Object" will be shown.

What is the expected behavior?

The simple app created above should run w/o raising exceptions and it should display "My First Angular 2 App".

The only workaround that I have found is to use the following as second argument to bootstrap():

[provide(Object, useFactory: () => new Object(), deps: [])].

Similar problems arise if instead of [Object] one tries to use, say, [BrowserClient] as second argument to bootstrap(), though, in this latter case an appropriate resolved_identifiers entry needs to be added to the pubspec.yaml. Replacing [Object] by [List] on the other hand gives stranger results.

Please tell us about your environment:

  • Angular version: 2.0.0-beta.19
  • Browser: tested in Dartium 45.0.2454.104 (64-bit) by myself and in Chrome by others.
  • Language: Dart

** Context **

This problem manifests itself in the context of the Angular.io Tour of Heroes, part 6 and the Dev Guide HTTP chapter.

Possibly relevant ng/ng issues:

/cc @kwalrath

b21: library import issues after the angular 2 transformer runs

I have a library where a class called Document resides

When I create a component that uses this Document class, I just import the library that provides it, without an alias, e.g. import 'package:library_containing_document_class.dart';

In this component, I did not import 'dart:html'.

The transformer however does import dart:html when it runs, and I get an exception saying:

'Document' from library 'dart:html' is hidden by 'Document' from library 'package:library_containing_document_class.dart'.
'Document' is imported here.
Try adding 'hide Document' to the import of 'dart:html'.

The transformer should introduce new imports always with a generated alias to avoid these conflicts

Allow to configure a `NodeValidator` or `TreeNodeSanitizer` for `[innerHtml]="..."`

<span [innerHtml]="someHtml">

currently results in

Removing disallowed attribute

My Workaround is currently using a custom directive

import 'dart:html' show Element, NodeTreeSanitizer;

import 'package:angular2/core.dart'
    show Directive, ElementRef, Input, OnChanges, SimpleChange;

@Directive(selector: '[safeInnerHtml]')
class SafeInnerHtml implements OnChanges {
  ElementRef _elRef;
  SafeInnerHtml(this._elRef);

  @Input()
  String safeInnerHtml;

  @override
  void ngOnChanges(Map<String, SimpleChange> changes) {
    (_elRef.nativeElement as Element).setInnerHtml(this.safeInnerHtml,
        treeSanitizer: NodeTreeSanitizer.trusted);
  }
}

Maybe similar to https://angular.io/docs/ts/latest/api/platform-browser/index/DomSanitizationService-class.html

b21: removing animation

I understand the choice to remove the animation directives,
according to the release notes, a new, more Darty solution will be provided at some point.

However I was depending on the animation directives, b21 left me with no alternative what so ever.

Please consider to properly deprecate code over releases.

Support generic types in a Component/Directive

This occurs when I compile using dart2js,

Say I have a Component defined as such:

class MyComponent<T extends something>

and I want to inject the following property:

final Container<T> myContainer;

I use @Inject(Container) this.myContainer; (generic type is not allowed here)

This generates the following warning:

[Warning from Dart2JS on ...]:
packages\...:
Cannot resolve type 'T'.
(Container<T> myContainer) => new MyComponent(myContainer),
          ^

OpaqueToken cannot be implemented in Dart

Migrated from angular/angular#8928, but with links refreshed.

Summary: The Angular DI OpaqueToken wrapper class exists solely to create unique token instances, independent of any string argument value that might be provided to the constructor. Given that the OpaqueToken constructor must be const in Dart, and that const constructors are canonicalized, it fails to serve its purpose. In fact, a const constructor that always returns a unique instance cannot be written in Dart.

Details

Each new Angular DI OpaqueToken is meant to be unique. Given that, in Dart, OpaqueTokens are meant to be used in annotations, they must be const; hence the class is defined as follows (note the const constructor):

class OpaqueToken {
  final String _desc;
  const OpaqueToken(this._desc);
  String toString() {
    return '''Token ${ this . _desc}''';
  }
}

But const objects are _canonicalized_ (cf. this commentary in the latex source, or correspondingly, page 68 in the 4th ed. of the spec). Those who might have a doubt can try:

@Component(
    selector: 'my-app',
    template: "<p>const OpaqueToken('abc') == const OpaqueToken('abc') is {{test}}</p>")
class AppComponent {
  final bool test = const OpaqueToken('abc') == const OpaqueToken('abc');
}

yields

const OpaqueToken('abc') == const OpaqueToken('abc') is true

Note: since OpaqueToken doesn't override ==, it uses the one defined in Object, which is true iff the operands are identical.

This issue came to light during rework of the angular.io DI chapters (for Dart and TS). Issue angular/angular.io#1563 has been opened to hold the thread of discussion of alternatives to OpaqueToken. Once an alternative has been agreed upon, at least for Dart, then OpaqueToken should be deprecated --- given that the Dart implementation is faulty and cannot be fixed, it should just be removed.

Remove the legacy template syntax and compiler

Angular hasn't officially supported the older bind-x syntax as part of documentation or examples for a long time, but the codebase still is running checks for the legacy templates.

I think now is the time to kill it and clean up the code.

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.