Skip to content

Instantly share code, notes, and snippets.

@planetsizebrain
Created March 3, 2016 20:08

Revisions

  1. planetsizebrain created this gist Mar 3, 2016.
    47 changes: 47 additions & 0 deletions view.jsp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
    <%@ taglib uri="http://liferay.com/tld/theme" prefix="theme" %>
    <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>

    <portlet:defineObjects />
    <theme:defineObjects />

    <div id="<portlet:namespace />app" class="co-app">
    <table ng-controller="listCtrl" id="listCtrl">
    <thead>
    <tr>
    <th>Date</th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="data in alldata">
    <td>{{data.effectiveDateTime}}</td>
    </tr>
    </tbody>
    </table>
    </div>

    <aui:script use="aui-base" position="inline">

    var app = angular.module('<portlet:namespace />', []);

    app.factory("services", ['$http', function($http) {
    var serviceBase = '/angular-hello-world-portlet/data/local.json';
    var obj = {};
    obj.getData = function() {
    return $http.get(serviceBase)
    }

    return {
    getData: obj.getData
    }
    }]);

    app.controller('listCtrl', function($scope, services) {
    services.getData().then(function(data) {
    $scope.alldata = data.data;
    });
    });

    angular.bootstrap(document.getElementById('<portlet:namespace />app'), ['<portlet:namespace />']);

    </aui:script>