angular/angular.js

Migrate angularjs applicaiton to vue js

ronak-zymr opened this issue · 1 comments

I'm submitting a ...

  • regression from 1.7.0
  • security issue
  • issue caused by a new browser version
  • [ X] other

Current behavior:
We are converting angularjs application to vue JS. We have imported vue JS library using bower and it is imported correctly.
We have successfully converted one of our angularjs page template to vuejs and it is working fine.

But when we are trying to convert angularjs service to ES6 class (Which is necessary to work with vuejs) we are getting the below error:

Cannot use import statement outside a module

MyService.service.js

export default class MyService {
  constructor() {
    this.items = [''];
  }

  getItem() {
    return this.items;
  }
}

Here in MyService.service.js file it is giving error
Unexpected token 'export'

MyService.js

import angular from 'angular';
import MyService from './MyService.service';

(function() {
  console.log("HURREYYY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
angular.module('app.impact.authentication')
  .factory('MyService', MyService);
})()

Here in MyService.js file it is giving error
Cannot use import statement outside a module

Expected / new behavior:
Import statement should work in angularjs controller page.

Minimal reproduction of the problem with instructions:

AngularJS version:
v1.7.2

Browser: [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView | Opera XX ]

This error is not related to AngularJS. It is a JavaScript error, most likely related to how you are bundling or serving the app.
Since this is a general support question, you can use one of the appropriate support channels.
GitHub issues are reserved for bug reports and feature requests.