GithubHelp home page GithubHelp logo

Comments (12)

kentcdodds avatar kentcdodds commented on July 25, 2024

Like this :-)

from angular-formly-templates-bootstrap.

kentcdodds avatar kentcdodds commented on July 25, 2024

Let me know if you need any more help :-)

from angular-formly-templates-bootstrap.

markleusink avatar markleusink commented on July 25, 2024

Updated URL to that example: http://angular-formly.com/#/example/bootstrap-specific/bootstrap-horizontal

from angular-formly-templates-bootstrap.

kentcdodds avatar kentcdodds commented on July 25, 2024

👍 thanks! Updating the original link as well.

from angular-formly-templates-bootstrap.

robrothedev avatar robrothedev commented on July 25, 2024

Just started using Angular Formly about 3 hours ago and needed a horizontal form. Talk about perfect timing :) Got it working like a charm and added a horizontalSelect type to boot. Thanks again!

from angular-formly-templates-bootstrap.

robrothedev avatar robrothedev commented on July 25, 2024

One thing I did notice, however, is that the templateOptions: {required: true} no longer provides the asterisk next to the label. I can manually add it to '{{to.label}} *' for a workaround in the setWrapper template.

from angular-formly-templates-bootstrap.

kentcdodds avatar kentcdodds commented on July 25, 2024

Yeah, I updated the example: http://angular-formly.com/#/example/bootstrap-specific/bootstrap-horizontal

from angular-formly-templates-bootstrap.

robrothedev avatar robrothedev commented on July 25, 2024

Works great. Thanks!

from angular-formly-templates-bootstrap.

tarkanlar avatar tarkanlar commented on July 25, 2024

how can i make horizontalSelect ?

from angular-formly-templates-bootstrap.

robrothedev avatar robrothedev commented on July 25, 2024

Per the documentation added here: http://angular-formly.com/#/example/bootstrap-specific/bootstrap-horizontal you can add a formlyConfigProvider.setType({}) for a select.

angular
    .module('app',['formly','formlyBootstrap'])
    .config(config);

function config(formlyConfigProvider) {
    // custom configuration for the formly templates
    formlyConfigProvider.setWrapper({
        name: 'horizontalBootstrapLabel',
        template: [
            '<label for="{{::id}}" class="col-sm-2 control-label">',
            '{{to.label}}  {{to.required ? "*" : ""}}',
            '</label>',
            '<div class="col-sm-9">',
            '<formly-transclude></formly-transclude>',
            '</div>'
        ].join(' ')
    });

    // horizontal inputs
    formlyConfigProvider.setType({
        name: 'horizontalInput',
        extends: 'input',
        wrapper: ['horizontalBootstrapLabel', 'bootstrapHasError']
    });

    // horizontal selects
    formlyConfigProvider.setType({
        name: 'horizontalSelect',
        extends: 'select',
        wrapper: ['horizontalBootstrapLabel', 'bootstrapHasError']
    });
}

HTML

<form class="form-horizontal">
  <formly-form
     model="ctrl.form_model"
     fields="ctrl.form_fields">
  </formly-form>
</form>

from angular-formly-templates-bootstrap.

tarkanlar avatar tarkanlar commented on July 25, 2024

Thanks @robrothedev, i should have seen that , sorry

from angular-formly-templates-bootstrap.

robrothedev avatar robrothedev commented on July 25, 2024

Not a problem and you're welcome.

from angular-formly-templates-bootstrap.

Related Issues (20)

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.