RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 576918
Accepted
jashka
jashka
Asked:2020-10-12 19:02:07 +0000 UTC2020-10-12 19:02:07 +0000 UTC 2020-10-12 19:02:07 +0000 UTC

ng-模型不工作

  • 772
<div ng-show="discount.discount.days_details.monday.enable"
     class="add-time-block"
     ng-class="showInterval">
    <button ng-click="discount.addInterval('monday', start_m, end_m);"
            class="edit blue">{{::discount.lc.b_add_period}}
    </button>
    <div class="input-group bootstrap-timepicker">
        <input type="time" placeholder="hrs:mins" ng-model="start_m"
               value="00:00"
               pattern="^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$"
               class="timepicker-rest-from">
        <strong>-</strong>
        <input type="time" placeholder="hrs:mins" ng-model="end_m" value="00:00"
               pattern="^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$"
               class="timepicker-rest-to">
    </div>
    <div>
        <span ng-repeat="interval in discount.discount.days_details.monday.intervals">{{::interval.from}} - {{::interval.to}}<br></span>
    </div>
</div>

底线是我使用angular-bootstrap-datepicker并且只有版本angular 1.3.5兼容它,但因此它不能正常工作ng-model。结果start_m,他们start_end会的undefined。
我无法将日期选择器更改为另一个,因为网站上的所有内容都是基于布局的。
但是如果你把angular放在上面1.3.5,比如 ,1.4.9那么就会出现这样的错误

Controller 'select', required by directive 'ngOptions', can't be found!
<div id="datepicker0" ng-datepicker 
    dp-options="discount.datepickersOptions.from"
    ng-model="discount.discount_dates.from"></div>

如何解决这个问题?

我将附上ng-bootstrap-datepicker的链接

angularjs
  • 2 2 个回答
  • 10 Views

2 个回答

  • Voted
  1. Best Answer
    jashka
    2020-10-12T19:12:53Z2020-10-12T19:12:53Z

    这个问题的解决方案是,我认为它不是很正确,但它解决了问题:
    我们angular-bootstrap-datepicker
    在指令中转到 y ngDatepicker,将 y 更改scope ngOptions为dpOptions。以及在哪里使用ngOptions

    • 0
  2. Dmitry Lobov
    2020-10-14T08:18:19Z2020-10-14T08:18:19Z

    ng-model不作为单个参数使用,而是作为视图对象date = {start_m : '', end_m: ''}和在模板中使用ng-model = "date.start_m"。

    • -1

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    如何停止编写糟糕的代码?

    • 3 个回答
  • Marko Smith

    onCreateView 方法重构

    • 1 个回答
  • Marko Smith

    通用还是非通用

    • 2 个回答
  • Marko Smith

    如何访问 jQuery 中的列

    • 1 个回答
  • Marko Smith

    *.tga 文件的组重命名(3620 个)

    • 1 个回答
  • Marko Smith

    内存分配列表C#

    • 1 个回答
  • Marko Smith

    常规赛适度贪婪

    • 1 个回答
  • Marko Smith

    如何制作自己的自动完成/自动更正?

    • 1 个回答
  • Marko Smith

    选择斐波那契数列

    • 2 个回答
  • Marko Smith

    所有 API 版本中的通用权限代码

    • 2 个回答
  • Martin Hope
    jfs *(星号)和 ** 双星号在 Python 中是什么意思? 2020-11-23 05:07:40 +0000 UTC
  • Martin Hope
    hwak 哪个孩子调用了父母的静态方法?还是不可能完成的任务? 2020-11-18 16:30:55 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    user207618 Codegolf——组合选择算法的实现 2020-10-23 18:46:29 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    Arch ArrayList 与 LinkedList 的区别? 2020-09-20 02:42:49 +0000 UTC
  • Martin Hope
    iluxa1810 哪个更正确使用:if () 或 try-catch? 2020-08-23 18:56:13 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5