从Azure MobileServices.InvokeApi返回值

时间:2015-07-13 16:14:18

标签: javascript azure azure-mobile-services

所以我试图从azure的appsettings中获取一个值,它成功返回值,但我试图返回该值。请耐心等待我这里有一些新的javascript代码。

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- collapsing view -->
    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <include
                …
                />

            <android.support.design.widget.TabLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags=“…”
                />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <!-- scrolling view -->
    <android.support.v4.view.ViewPager
        android:id="@+id/main_viewpager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

    </android.support.v4.view.ViewPager>

    <android.support.design.widget.FloatingActionButton
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|right|end"
        android:src="@drawable/ic_add"
        android:layout_margin="@dimen/minor_horizontal_margin"
        android:clickable="true"/>

</android.support.design.widget.CoordinatorLayout>

当我调用getAppSettings函数时,它会返回一个未定义但在“promise”内,如果我添加一个console.log,它会显示结果。有任何想法吗。 感谢

1 个答案:

答案 0 :(得分:0)

我建议你使用棱角分明的&#34;工厂&#34; getAppSettings: function (mobilesvc, appSettings) { return mobilesvc.invokeApi(appSettings, { method: 'GET' }).then(function (results) { return results; }, function (error) { }); }它应该最终能够返回值。 :)