9 Replies Latest reply on Apr 3, 2015 8:15 AM by kalaoke

    Angularjs jive app

    kalaoke

      Hi,

      I’m trying to make an existing web application a jive app. The existing application is based on the mean.js framework : basically this is an angular.js app served by a node.js server. Our jive instance is a custom hosted instance version 7.0.3.1.


      Following the available documentation (here), I wrote an app.xml file :


      <?xml version="1.0" encoding="UTF-8"?>

      <Module specificationVersion="1">

        <ModulePrefs title="hckApp"

                      description="Description of hckapp"

                      author="LK"

                      author_affiliation="HCK"

                      author_email="XXX@YYY.com">

            <!-- Commonly used features -->

            <Require feature="dynamic-height" />

            <Require feature="jive-core-v2" />

            <Require feature="osapi"/>

            <Require feature="settitle"/>

            <Require feature="views" />

            <Require feature="jive-core-v3" />

            <Require feature="embedded-experiences" />

            <Require feature="actions">

                <Param name="action-contributions">

                    <![CDATA[

                    <action id="com.jivesoftware.contentaction"

                            path="jive/actions/content/*"

                            label="My Content Action"

                            url="https://developer.jivesoftware.com/"/>

              ]]>

                </Param>

            </Require>

            <!-- Icons: 3 sizes, 16x16, 48x48, 128x128 -->

            <Link rel="Icon"      href="images/icon16.png" />

            <Link rel="MediumIcon" href="images/icon48.png" />

            <Link rel="LargeIcon"  href="images/icon128.png" />

        </ModulePrefs>

        <Content type="url" view="home" href="APP URL HERE" preferred_height="600" />

        <Content type="url" view="canvas" href="APP URL HERE" preferred_height="600"/>

      </Module>


      After installing the app on our jive instance, it seems to work but apparently the resources referenced in the app.xml file (osapi, ...) are not loaded.

      For example if we write in the home controller of our meansjs application :


      angular.module('core').controller('HomeController', ['$scope', 'Authentication',

        function($scope, Authentication) {

              function getUsersFromResponse(response) {

                  var users = [];

                  if(response.data instanceof osapi.jive.core.User) {

                      users.push(response.data);

                  } else if (response.data instanceof Array) {

                      users = response.data;

                  }

                  return users;

              }

          // This provides Authentication context.

          $scope.authentication = Authentication;

          $scope.selectUser = function () {

                 var callback = function(response) {

                      var users = getUsersFromResponse(response);

                      console.log(users);

                  };

                  osapi.jive.core.users.requestPicker({success: callback, multiple: false});

           }

        }

      ]);


      At runtime, the browser’s javascript console produces an error : “osapi is not defined”

      Any clues?

      Thanks for help.