具有损坏的自动导入的Visual Studio代码

时间:2017-12-30 06:31:42

标签: angular import autocomplete visual-studio-code

在Visual Studio代码中,我在处理AngularJS时经常遇到自动导入功能问题。自动导入正在运行,但它导入了错误的类。

例如。打字...

try {
                    JSONObject  jsonObject = new JSONObject(status1);
                    JSONArray array=jsonObject.getJSONArray("Login Details");
//"Login Details":[{"name":"abc","place":"abcdd","cityname":"asdf"}] only one object 
                    for (int i=0;i<array.length();i++){


                        jsonObject = array.getJSONObject(i);

                        name= jsonObject.getString("name");
                        place= jsonObject.getString("place");
                        cityname = jsonObject.getString("cityname");


                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }

VSC是自动导入......

RouterModule.forRoot..

但是他导致了错误

import { RouterModule } from "@angular/router/src/router_module";

正确的导入应该是:

Module not found: Error: Can't resolve '@angular/router/src/router_module'

我做错了什么?我可以阻止VSC导入错误的类吗?

0 个答案:

没有答案