angular-skycons

WebJar for angular-skycons

License

License

MIT
Categories

Categories

Github Development Tools Version Controls Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

github-com-projectweekend-angular-skycons
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

angular-skycons
WebJar for angular-skycons
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/projectweekend/angular-skycons

Download github-com-projectweekend-angular-skycons

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/github-com-projectweekend-angular-skycons/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>github-com-projectweekend-angular-skycons</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-projectweekend-angular-skycons/
implementation 'org.webjars.bower:github-com-projectweekend-angular-skycons:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-projectweekend-angular-skycons/
implementation ("org.webjars.bower:github-com-projectweekend-angular-skycons:2.0.1")
'org.webjars.bower:github-com-projectweekend-angular-skycons:jar:2.0.1'
<dependency org="org.webjars.bower" name="github-com-projectweekend-angular-skycons" rev="2.0.1">
  <artifact name="github-com-projectweekend-angular-skycons" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='github-com-projectweekend-angular-skycons', version='2.0.1')
)
libraryDependencies += "org.webjars.bower" % "github-com-projectweekend-angular-skycons" % "2.0.1"
[org.webjars.bower/github-com-projectweekend-angular-skycons "2.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower » github-com-darkskyapp-skycons jar 0.0.0-41ff933289

Project Modules

There are no modules declared in this project.

This is an AngularJS module that makes it super easy to add Forecast.io skycons to your app. Skycons is an open-source set of animated weather glyphs that uses JavaScript and the HTML5 canvas element.

Example Skycons Note: my crappy screen shot image is not animated ;)

Installation

This project, along with all of its dependencies are installed with Bower: bower install angular-skycons.

Set up

If you're familar with how to include third-party modules in AngularJS, then you can probably skip this section. If you're new to the framework, this should help.

Step 1

Include the following files before the main app file:

<script src="/bower_components/skycons/skycons.js"></script>
<script src="/bower_components/angular-skycons/angular-skycons.js"></script>
<script src="/js/app.js"></script>

Or use the minified version. As a convenience, this version has the skycons.js dependency included so you only need to include one file.

<script src="/bower_components/angular-skycons/angular-skycons.min.js"></script>
<script src="/js/app.js"></script>

Step 2

Add angular-skycons to the app requirements (/js/app.js).

var app = angular.module('myApp', [
    'myApp.controllers',
    'myApp.filters',
    'myApp.services',
    // 3rd party dependencies
    'angular-skycons'
]);

Use it

This module creates a custom directive (tag) that you can use anywhere in your templates. This directive has four attributes:

  • icon - This one is required since it defines which icon you want to display. It also must be bound to a property of a controller. The accepted values for this attribute correspond to the values returned in the icon property of data point objects in the Forecast.io API. The possible options are: clear-day, clear-night, rain, snow, sleet, wind, fog, cloudy, partly-cloudy-day, or partly-cloudy-night.
  • size - This is optional, but must be bound to a property of a controller. Having this value come from the controller means that you can set it dynamically based on things like $window.innerWidth, etc. Since the icon is always a square, you only need to provide a single value. If the size attribute is not present, the default is a 64px square.
  • animated - This is optional, but must be bound to a property of a controller. Setting the value to false or the string "false" will stop animation of the icon.
  • color - This is optional, but must be bound to a property of a controller. If it is not present, the default is black.
  • class - Use this to set the CSS class if needed.

Controller Example

var cMod = angular.module( 'myApp.controllers', [] );

cMod.controller( 'WeatherCtrl', function ( $scope ) {

    /*
        This example is over simplified to demonstrate the relationship
        between the 'controller' and the 'template' with regard to loading
        the 'icon' value. Hopefully, you will be loading your controller with
        data from an actual API response. :)
    */
	$scope.CurrentWeather = {
        forecast: {
            icon: "partly-cloudy-night",
            iconSize: 100,
            color: "blue",
            ...
        }
    };

} );

Template Example

<skycon icon="CurrentWeather.forecast.icon" size="CurrentWeather.forecast.iconSize"></skycon>

<skycon icon="CurrentWeather.forecast.icon"></skycon>

<skycon icon="CurrentWeather.forecast.icon"></skycon>

Versions

Version
2.0.1