Code Monkey home page Code Monkey logo

liferay-angularjs-examples's Introduction

Samples of using Angular JS in Liferay

All of the examples above are bootrapped manually with angular.bootstrap(... , ...) method, to isolate the app module for each portlet, this approach does not use ng-app

Angular Portlet

Is just the portlet that contains the angular and angular ui files to make work the following samples, this portlet need to be dropped in the same page, otherwise these files need to be handled different for example, including them in the theme.

Learning Portlet

Uses $resource to retrieve all the liferay categories via ajax from the controller, also is using portlet serveResource method to call the liferay api and process the json response. Also uses the angular $scope.$apply method to refresh the scope when integrating global events in js using ootb Liferay.on(..., ...)

Second Learning Portlet

Is a simple form with validation, to add a category, also triggers a portlet ajax call using $resource and fires a liferay javascript global event with Liferay.fire(..., ...) so if Learning Portlet is in the same page, it will listen when a category has been added and will refresh the list displayed with the new category added.

Third Learning Portlet

Sets routes, simple resolvers that will be passed to the controller, listens route changes

Fourth Learning Portlet

Using bootstrap angular-ui to generate pagination, retrieves categories from liferay and lists them inside of table, pagination links redirects to configured routes, so the link can be pasted again in the browser and will show the specific page in the table with respective results, also uses resolver in the routes configuration to load the table data before controller is proccessed.

Also this example is folder structured by module types, will see a folder structure like:

fourth-learning-portlet
|---- docroot
    |---- js
        |---- ng-app
            |---- controllers
                |---- category-list.js
            |---- services
                |---- category.js
            |---- views
                |---- category-list.html
            |---- app.js
            |---- bootstrap.js

liferay-angularjs-examples's People

Contributors

asotog avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.