angular-simple-focus

WebJar for angular-simple-focus

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-simple-focus
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

angular-simple-focus
WebJar for angular-simple-focus
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/deltreey/angular-simple-focus

Download angular-simple-focus

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : angular jar [1,2)

Project Modules

There are no modules declared in this project.

angular-simple-focus

An attribute to focus an element when it appears and by a value.

It's a simple angularjs directive that focuses an input when it appears and whenever you set a value to true. This means that this works to set the focus on page load, and as an element is created as part of an ng-repeat and of course it can be set manually.

Because it's such a small amount of code, it should be able to read and understand so you can even tweak it for your needs. In fact, I encourage it!

Available on Bower

bower install angular-simple-focus

How To

Simply include the simple-focus module

var app = angular.module('app', [ 'simple-focus' ]);

Then use the simple-focus attribute on your html elements

<input type="text" simple-focus="someValue" />

Note that the simple-focus attribute must have a value, but that value is arbitrary, so pick whatever you want. The value is pulled in from your controller's $scope, so $scope.someValue in my controller is the value for the simple-focus attribute above. If I set $scope.someValue = true; in my controller, the input would get focus.

There are lots of different directives just like this one. And lots of people have attempted to explain it in examples In fact, this code is almost an exact copy of this example gist. I built this one because none of the other ones worked exactly this way, most of them were just examples, not a project that people could feel like they were a part of, and most of them were much more complicated both to use and to develop for. This one is simple. If it doesn't perfectly fit your needs, I have confidence it will help you understand enough to redesign it for yourself. I'll even happily accept pull requests and issues to improve it.

Check out the github pages example here: http://deltreey.github.io/angular-simple-focus/

Versions

Version
0.0.1