AngularJS Google Maps API异步加载

时间:2015-05-07 20:30:28

标签: javascript angularjs google-maps

您好我尝试在此链接后在AngularJS中异步加载google地图api:http://angular-ui.github.io/angular-google-maps/#!/

我收到以下错误:

public class GoalDetailViewAdapter extends ParseQueryAdapter<ParseObject> {

    protected ParseObject mPracticeName;



    public GoalDetailViewAdapter(Context context) {




        super(context, new ParseQueryAdapter.QueryFactory<ParseObject>() {

            public ParseQuery create() {
                // Here we can configure a ParseQuery to display
                // midwives
                ParseQuery<ParseObject> query = ParseQuery.getQuery("goal");
                query.whereEqualTo("createdby", ParseUser.getCurrentUser());

                return query;
            }
        });
    }



    @Override
    public View getItemView(ParseObject object, View view, final ViewGroup parent) {

        if (view == null) {
            view = View.inflate(getContext(), R.layout.activity_goal_detail_view, null);

        }

        //use midwifefirm as item view/list

        super.getItemView(object, view, parent);


        // find in layout the practice name
        TextView titleTextView = (TextView) view.findViewById(R.id.goalname);

        //in the midwifefirm data model, call getPracticename
        titleTextView.setText(object.getString("goalname"));


        TextView practiceTextView = (TextView) view.findViewById(R.id.practicename);

        ParseRelation relation = object.getRelation("practicerelation");


        relation.getQuery().findInBackground(new FindCallback() {
            @Override
            public void done(List list, ParseException e) {
                if (e !=null) {
                    //error

                }

                else {


                }
            }


        });



        /*mAddGoal = (ImageButton) view.findViewById(R.id.addgoal);
        mAddGoal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(parent.getContext(), AddGoal.class);
                v.getContext().startActivity(intent);
            }


        });*/

        return view;

我的代码(请注意:我刚开始使用AngularJS 2-3天前,我想我的错误很容易解决,一旦我完全理解为什么这不起作用):

Error: [$injector:modulerr] Failed to instantiate module due to:
[$injector:modulerr] Failed to instantiate module RegisterClientModule  due to:
undefined is not an object (evaluating 'uiGmapGoogleMapApiProvider.configure')

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

您错过了在您的app模块中添加uiGmapgoogle-maps。这将使uiGmapGoogleMapApiProvider&amp;谷歌地图的所有其他API。

var module = angular.module('RegisterClientModule', ['uiGmapgoogle-maps'])
相关问题