Skip to content

DrupalHub/flag-directive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Set up

Define a config file for the flag directive that will hold the base api end point:

angular.module('flagConfig').constant('flagConfig', {
  'server': 'http://localhost/drupal/api/'
});

One of the controllers should implement a listener. The listener will set the access token of the current user. For example:

  $scope.$on('flagAccessToken', function(event, data) {
    data.accessToken = localStorageService.get('access_token');
  });

There are two directives available for you. One it's the like flag which display the likes a given entity have in the DB:

<flag-like type="like" likes="{{object.like}}" entity="node" id="{{object.id}}"></flag-like>

This directive will be available with the like.js file.

Another directive which can be used it's the toggle directive. This directive will be used to check or un-check an entity. A good example is a flag for follow or unfollow an entity:

<flag-toggle
  endpoint="question_follow"
  entity="node"
  entity-id="{{object.id}}"
  text-flagged="Unfollow"
  text-unflagged="Follow"
  class-flagged="fa fa-envelope"
  class-unflagged="fa fa-envelope-o"></flag-toggle>

Drupal part

For now you'll need to set up a few things. Look at this gist for more info.

You also need to enable Restful token auth module.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors