角度材料日期选择器与空白日历

Lui*_*ssi 4 angularjs angular-material

我在角度材料版本1.1.1中使用日期选择器时遇到了一些麻烦,如果我改为角度材料1.1.0日历工作,就像我放在codepen上:http://codepen.io/lhrossi/pen/ eBQLoy

这是我的HTML:

<md-content md-theme="infocargas" layout-padding>
    <form name="newDeliveryForm">
        <div layout-gt-xs="row">
            <md-input-container class="md-block" flex-gt-xs>
                <label>Operador Logístico (Bloqueado)</label>
                <input ng-model="company" disabled /> 
            </md-input-container>
        </div>

        <div layout-gt-sm="row">

            <md-input-container flex-gt-sm>
                <label>Digite CTe</label>
                <input ng-model="delivery.cte" />
            </md-input-container>

        </div>

        <div layout-gt-sm="row">

            <md-input-container flex-gt-sm>
                <label>Entrega Para</label>
                <!--<md-datepicker ng-model="myDate"></md-datepicker>-->
                <md-datepicker ng-model="myDate" md-placeholder="Enter date"></md-datepicker>

            </md-input-container>

        </div>
        <md-button class="md-raised md-primary">Gerar Código</md-button>

    </form>

</md-content>
Run Code Online (Sandbox Code Playgroud)

这是一个错误,还是有其他想法呢?我害怕改变材料版本,以免破坏系统上的其他东西.

我感谢任何帮助.

Vi1*_*100 5

Angular 1.6在编译器上引入了一些优化,这些优化打破了datepicker的功能(它们在Angular changelog中被列为重大变化).

虽然Angular Material团队没有发布新的补丁版本(可能在一两年内......)但它不起作用,但你可以禁用一些角度优化以回到之前的行为,如上所述在本期关于Material repo的问题.

angular.module('myApp', []).config(function($compileProvider) {
    $compileProvider.preAssignBindingsEnabled(true);
});
Run Code Online (Sandbox Code Playgroud)

基本上,你在这里做的是配置$ compileProvider以便像往常一样工作.如果你不这样做,那么组件的初始化代码应该驻留在$ onInit()回调中,正如Angular的更改日志中的这一重大变化所述