Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] error happended when used in ngRoute #27

Closed
kacha-zhou opened this issue Dec 11, 2014 · 4 comments
Closed

[HELP] error happended when used in ngRoute #27

kacha-zhou opened this issue Dec 11, 2014 · 4 comments

Comments

@kacha-zhou
Copy link

below is source code.

app.js

angular
  .module('heloApp', [
    'ngRoute',
    'ng-polymer-elements'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/main', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .when('/', {
        templateUrl: 'views/login.html',
        controller: 'LoginCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });

index.html

...
<body unresolved ng-app="heloApp">
      <div class="main-container" ng-view=""></div>

    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/angular-route/angular-route.js"></script>
    <script src="bower_components/platform/platform.js"></script>
    <script src="bower_components/ng-file-upload/angular-file-upload-shim.min.js"></script>
    <script src="bower_components/ng-file-upload/angular-file-upload.min.js"></script>

    <script src="scripts/ng-polymer-elements.js"></script>
    <script src="scripts/app.js"></script>
    <script src="scripts/controllers/login.js"></script>
...

login.js

angular.module('heloApp').controller('LoginCtrl', ['$scope', function($scope){
......
}])

login.html

<core-header-panel mode="medium-tall">
    <div class="core-header">
        <span>Helo</span>
    </div>
    <div class="content" vertical layout center>
        <paper-input label="Your Name" ng-model="userid"></paper-input>
        <paper-input type="password" label="Your Password"></paper-input>
        <paper-button raised ng-click="login()">Login</paper-button>
    <core-ajax id="ajax"></core-ajax>
    </div>
</core-header-panel>

Below is error info.

ReferenceError: PathObserver is not defined
    at http://localhost:9000/scripts/ng-polymer-elements.js:154:50
    at Array.forEach (native)
    at angular.module.config.Object.keys.forEach.$compileProvider.directive.link (http://localhost:9000/scripts/ng-polymer-elements.js:105:28)
    at http://localhost:9000/bower_components/angular/angular.js:8188:44
    at invokeLinkFn (http://localhost:9000/bower_components/angular/angular.js:8194:9)
    at nodeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7706:11)
    at compositeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7062:13)
    at compositeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7065:13)
    at compositeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7065:13)
    at publicLinkFn (http://localhost:9000/bower_components/angular/angular.js:6941:30) <paper-input label="Your Name" ng-model="userid" class="ng-pristine ng-untouched ng-valid ng-isolate-scope">

How should I use ng-polymer-elements in ngRoute?
Can you give me a example?
Thanks!

@GabiAxel
Copy link
Owner

This probably happens because you are using automatic bootstrapping. Please read the section about installing ng-polymer-elements - automatic bootstrapping currently works only with the latest Chrome and Opera, for other browsers use manual bootstrapping after Polymer has been initialized.

@kacha-zhou
Copy link
Author

Thank you very much for your answer.
but my browser is chrome 39.0.2171.71 m.

@GabiAxel
Copy link
Owner

Then maybe I was wrong about this not being needed. Can you try switching to manual bootstrapping as demonstrated in the example and let me know if it works?

@kacha-zhou
Copy link
Author

To: GabiAxel
When i add below the source into index.html, it becomes work. even use automatic bootstrapping.

<script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants