Giter Site home page Giter Site logo

deanpdx / angular-input-focus Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 3.01 MB

An Angular directive that allows you to control focus including autofocus-like functionality

License: MIT License

JavaScript 21.15% TypeScript 72.84% HTML 4.08% SCSS 1.94%
angular attribute directive focus forms input

angular-input-focus's Introduction

Hello!

I'm a Portland, Oregon-based Software engineer. A gopher by way of .NET. My bread and butter is writing Angular apps for various clients with golang services and MariaDB / Postgres databases. I have two Angular libraries in the npm (angular-input-focus and angular-validation-summary). I write infrequent blog posts about writing software (I try to go for quality over quantity). I'm currently working for Sembit.

Need help with something? I enjoy giving back to the software community so drop me a line!

angular-input-focus's People

Contributors

deanpdx avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dusdong

angular-input-focus's Issues

Error using directive

I don't have much information, but I'm adding 2 attributes to some components and am getting this error:

core.mjs:6362 ERROR TypeError: Cannot read properties of undefined (reading 'pipe')
    at set setFocus [as setFocus] (angular-input-focus.mjs:50:15)
    at setInputsForProperty (core.mjs:13120:13)
    at elementPropertyInternal (core.mjs:12218:9)
    at ɵɵproperty (core.mjs:14457:9)
    at MyComponent_ng_container_5_Template (my.component.html:11:70)
    at executeTemplate (core.mjs:11835:9)
    at refreshView (core.mjs:11698:13)
    at refreshEmbeddedViews (core.mjs:12747:17)
    at refreshView (core.mjs:11722:9)
    at refreshComponent (core.mjs:12793:13)

This is the code I'm using and it is working on some page:

[libFocus]="false"
[setFocus]="focusEventEmitterMap.get('controlName')!"

The error shows up on page load.

Any ideas?

Conditionally focus based on event?

Using [setFocus] is it possible to send some kind of data to conditionally set focus to an element?

I have several rows of select elements. The user can add another row and I want to set focus on the row right after we added it. So if I have something like:

<row *ngFor="let row=this.rows; let i = index">
<select id="row{{ i }}" [libFocus]="false" [setFocus]="myEventEmitter">...</select>
</row>

And in my component I add a new row to this.rows I only want to focus on the row I just added and I don't want it to retake focus if the user clicks or tabs to something else.

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.