I'm setting up an AngularDart/PolymerDart project, but I keep running against the following error:
Breaking on exception: Module.DEFAULT_REFLECTOR not initialized for dependency injection. http://goo.gl/XFXx9G
Now I've read the page behind the url given at the end of the error and did some Stackoverflowing, but the only sollution I came across was adding -angular as a transformer in the pubspect.yaml. And so I did. But still I keep getting the same error and my project won't start.
My pubspec.yaml:
name: application
description: application
dependencies:
angular: '>=1.0.0 <2.0.0'
angular_node_bind: any
core_elements: '>=0.3.2 <0.5.0'
paper_elements: '>=0.5.0 <0.6.0'
polymer: '>=0.14.0 <0.16.0'
web_components: '>=0.9.0 <0.10.0'
dependency_overrides:
args: '>=0.10.0 <0.12.0'
code_transformers: '>=0.1.4+2 <0.3.0'
html5lib: '>=0.10.0 <0.13.0'
observe: '>=0.11.0 <0.13.0'
transformers:
- angular
- polymer:
entry_points:
- client/web/index.html
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Application</title>
<!-- include the web_components polyfills with support for Dart. -->
<script src="../packages/web_components/platform.js"></script>
<!-- imports -->
<link rel="import" href="../packages/polymer/polymer.html">
<link rel="import" href="components/component.html">
</head>
<body>
<!--
don't put ng-app on html or body. the polymer build inlines
custom elements definitions, which can trigger bugs if the code
inlined is inside of ng-app
-->
<div ng-app>
<section>
<p>Angular</p>
<p>
<input type="text" ng-model="cool"> Angular binding: {{cool}}
</p>
</section>
<section>
<p>Polymer</p>
<my-element message="[[ cool ]]"></my-element>
</section>
</div>
<!-- initialize -->
<script type="application/dart" src='dart/init.dart'></script>
<script src="../packages/browser/dart.js"></script>
</body>
</html>
init.dart:
import 'package:polymer/polymer.dart';
import 'package:angular/application_factory.dart';
import 'package:angular_node_bind/angular_node_bind.dart' show NodeBindModule;
void main() {
initPolymer()
.run(() {
applicationFactory()
.addModule(new NodeBindModule())
.run();
});
}
It appears that the "web" folder MUST be in the same folder as your pubspec.yaml. I placed the web folder inside a folder "client", which caused the problem. Putting the web folder in the project root folder again fixed the issue.
Related
I am using Grails 2.5.6. I am editing spring-security-plugin.
My spring-security-plugin version is 2.0-RC5. I need to link a
javascript file in my view. But it shows file not found. Here are my attepmts below:
in my view >>>
<head>
<title>Royal Page</title>
<link href="${resource(dir: 'css', file: 'common.css')}" type="text/css" rel="stylesheet">
my directory structure >>>
I have an app I developed in Android. I installed a VM with Mac, and I'm testing it in iOS. The app worked perfectly in Android, but in iOS it is not. When I use 'ionic serve' or 'ionic serve --lab' the browser show a white screen, and in the console I get this errors (link of image below):
Console
Here is some code from the index.html:
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="lib/ionic/css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/bluebird.min.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic.cloud.min.js"></script>
<script src="lib/ionic/js/ionic-modal-select.min.js"></script>
<script src="lib/ionic/js/ionic-toast.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
I'm really lost here because the exact same files works OK for Android.
Which error you are posted, not library error.Error coming from app.js file.If you dont mind create a new ionic app and replace your file in new app.it will works.
I am having a problem with my ionic project, it is not loading cordova.js file or ngCordova.js file.
Here is my index.html file
<!DOCTYPE html>
<html>
<head>
<script src="lib/ngCordova/dist/ng-cordova.js"/>
<script src="cordova.js"></script>
<script type='text/javascript' src="lib/cryptojslib/rollups/aes.js"></script>
...
</head>
When I deploy the app on my iphone, aes.js and cordova.js file is loaded, the problem is ng-cordova.js is not loaded because when I invoke that code I get:
Error: Can't find variable: cordova
scan#file:///var/containers/Bundle/Application/6888FB51-F164-46EC-89AC-B8960C93FC7A/Nastic.app/www/lib/ngCordova/dist/ng-cordova.js:596:16\
....
If I switch lines:
<!DOCTYPE html>
<html>
<head>
<script src="cordova.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"/>
<script type='text/javascript' src="lib/cryptojslib/rollups/aes.js"></script>
...
</head>
Then ng-cordova.js is loaded, but aes.js is not loaded.
I was looking for a fix to this problem but couldn't find anything that solved the issue, however lot of similar issues.
Thanks
You should always include the file cordova.js after loading ng-cordova.js
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<script src="lib/cryptojslib/rollups/aes.js"></script>
Reference: http://ngcordova.com/docs/install/
I want update polymer app from version "^0.16.4" to '1.0.0-rc.5'. I have some lines in pubspec.yaml:
environment:
sdk: '>=1.12.0 <2.0.0'
dependencies:
bwu_datagrid:
git:
url: 'https://github.com/bwu-dart/bwu_datagrid'
ref: 'polymer1'
polymer: '1.0.0-rc.5'
polymer_interop: '^1.0.0-rc.3'
reflectable: '>=0.3.2 <0.3.4'
web_components: '^0.12.0'
dependency_overrides:
code_transformers: '^0.4.0'
reflectable:'^0.5.0'
redstone: '0.5.21+1'
quiver: '>=0.21.3 <0.22.0'
analyzer:'0.27.1'
polymer:'^1.0.0-rc.5'
args: '>=0.12.1 <0.14.0'
But when I run pub get, I get errors:
Error on line 24, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/initialize-0.6.1+2/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: '**/*_test.dart'
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 23, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/polymer_interop-1.0.0-rc.7/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: test/**_test{.*,}.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 26, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/web_components-0.12.0+4/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: '**/*_test.html'
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 19, column 3 of ../../../.pub-cache/hosted/10.10.3.91%588080/polymer-1.0.0-rc.5/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
- web_components
dart --version
Dart VM version: 1.13.2 (Tue Jan 5 06:49:57 2016) on "linux_x64"
pub --version
Pub 1.13.2
Maybe some advice on how it can be solved?
transformer section in pubspec.yaml:
transformers:
- polymer:
entry_points:
- web/index.html
- $dart2js:
minify: true
commandLineOptions:
- --trust-type-annotations
- --trust-primitives
- --enable-experimental-mirrors
pub serve print that:
[Info from Reflectable on web_tt_client|web/index.bootstrap.initialize.dart]:
Ignoring entry point that does not include the class `Reflectable`.
Build completed successfully
and in dartium console:
Uncaught Unhandled exception:
Bad state: Reflectable has not been initialized. Did you forget to add the main file to the reflectable transformer's entry_points in pubspec.yaml?
spa.dart file:
library spa;
import 'package:polymer/polymer.dart';
import 'package:web_tt_client/routers/routers.dart';
//Components
import 'package:web_tt_client/components/page_view/page_view.dart';
main() async {
await initPolymer();
await prepareViewElement();
await prepareRouters();
}
index.html file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script src='https://cdn.firebase.com/js/client/2.2.7/firebase.js'></script>
<!-- JSON-Schema library tv4-->
<script src="packages/web_tt_client/js/tv4/tv4.min.js"></script>
<script src="packages/web_components/webcomponents.min.js"></script>
</head>
<body>
<page-view></page-view>
<br>
<div id="html_log" style="white-space: nowrap;"></div>
<script type="application/dart" src="spa.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
Pub update. Newer version of packages avalible for:
grinder 0.6.6+3 (0.8.0+2 available)
http_multi_server 1.3.2 (2.0.0 available)
http_parser 0.0.2+8 (2.0.0 available)
postgresql 0.2.14 (0.3.3 available)
redstone 0.5.21+1 (0.6.0+1 available)
redstone_mapper 0.1.13 (0.2.0-beta.1+1 available)
redstone_mapper_pg 0.1.1 (0.2.0-beta.2+2 available)
shelf 0.5.7 (0.6.4+3 available)
test 0.12.3+9 (0.12.7 available)
Change pubspec.yaml dependency_overrides section, can solve it.
dependency_overrides:
code_transformers: '^0.4.0'
reflectable:'^0.5.0'
redstone: '0.5.21+1'
quiver: '>=0.21.3 <0.22.0'
analyzer:'0.27.1'
polymer:'^1.0.0-rc.5'
args: '>=0.12.1 <0.14.0'
I am trying out a Polymer Dart App under Cordova. So I started with the Dart Editor Sample App.
I use a recent version of Polymer so I had to edit the sample code. Here is my pubspec.yaml
name: cortst
description: Cordova Test Application
dependencies:
polymer: '>=0.15.1+3 <0.16.0'
transformers:
- polymer:
entry_points:
- web/cortst.html
And here is the combined HTML and Dart. I think the initialization uses the new/approved technique:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample App</title>
<link rel="import" href="clickcounter.html">
<link rel="stylesheet" href="cortst.css">
<script type="application/dart">
import 'dart:async';
import 'package:polymer/polymer.dart';
void main() {
initPolymer().run( () {
Polymer.onReady.then( (_) {
new Future( () {
// stuff goes here!
});
});
});
}
</script>
</head>
<body>
<h1>A Test</h1>
<div id="sample_container_id">
<click-counter count="5"></click-counter>
</div>
</body>
</html>
To generate stand-alone JavaScript I run dart2js via the command line:
pub build --mode=debug
And these are the results:
Dartium (37.0.2062.120 (292122) via Dart Editor 1.7.2) - OK
Run as JavaScript on Chrome (38.0.2125.111 m) - OK
Run as JavaScript on Firefox (33.0.3) - OK
dart2js and run on Chrome - no shadow DOM.
dart2js and run on Firefox - OK
When it fails the click counter is rendered (invisibly) as
<click-counter count="5"></click-counter>
This Chrome problem matters because the standard web host on Android is Chrome.
For brevity, I have embedded the Dart script in the HTML. I get the same results when I use a separate .dart file.
Perhaps I have overlooked something - it wouldn't be the first time...