问题标签 [ng-bind]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
888 浏览

javascript - 如何使用 $scope 和 ng-bind 在 AngularJS 中检索文本框条目

我目前正在尝试扩展 Umbraco 后台,为此我需要使用 Angular Js。到目前为止一切顺利,我已经连接了一个按钮,该按钮会触发对 WebApi 控制器的请求并返回确认服务更新已经发生但是,我现在想包含一个文本框,用户可以在其中输入一个数字然后作为查询字符串参数附加到 AngularJs 中的 WebApi 调用。

到目前为止,这是我的代码:

HTML:

AxumUpdateService.service.js

AxumUpdateService.controller.js

问题是我使用 $scope.tourId 的地方,因为它似乎没有检索我输入到与 ng-bind 绑定的文本框中的任何值。如何使用 AngularJs 检索这些用户输入的值?

0 投票
0 回答
55 浏览

javascript - AngularJS 范围与绑定

我只是对我遇到的这个问题感到好奇:

在 MainController 我有这个:

在 html 布局页面中,我有这个。

上面的这个不起作用,{{_layout.currentYear}} 什么都不显示,但如果我把它改成 ng-bind,那么它就起作用了。

为什么 {{_layout.currentYear}} 语法不起作用?

0 投票
2 回答
5094 浏览

javascript - 为什么 AngularJS ng-bind 不更新视图

ng-bind为什么这个小角度模块在属性更改时无法更新视图?

我期待 5 秒后输出的变化Hello Jon保持在Hello Whirled. 为什么是这样?我还需要做其他事情吗?

0 投票
1 回答
1603 浏览

javascript - AngularJS 中 ng-bind、ng-bind-html、ng-bind-html-unsafe 之间的区别?

我想知道和之间ng-bind的区别。ng-bind-htmlng-bind-html-unsafe

此外,当我在下面运行代码时,我收到如下所述的错误:

代码 :

错误 :

错误:[$sce:unsafe] 试图在安全上下文中使用不安全值。 http://errors.angularjs.org/1.3.11/ $sce/unsafe 在 REGEX_STRING_REGEXP ( https://www.angularapprj.com:4443/js/angular.js:63:12 ) 在 htmlSanitizer ( https:// www.angularapprj.com:4443/js/angular.js:15053:13 ) 在 getTrusted ( https://www.angularapprj.com:4443/js/angular.js:15217:16 ) 在 Object.$get.sce .(匿名函数) [as getTrustedHtml] ( https://www.angularapprj.com:4443/js/angular.js:15897:16 ) 在 Object.ngBindHtmlWatchAction [as fn] ( https://www.angularapprj.com :4443/js/angular.js:20449:29 ) 在 Scope.$get.Scope.$digest (https://www.angularapprj.com:4443/js/angular.js:14230:29 ) 在 Scope.$get.Scope.$apply ( https://www.angularapprj.com:4443/js/angular.js :14493:24 ) 在 BootstrapApply ( https://www.angularapprj.com:4443/js/angular.js:1449:15 ) 在 Object.invoke ( https://www.angularapprj.com:4443/js/angular .js:4182:17 ) 在 doBootstrap ( https://www.angularapprj.com:4443/js/angular.js:1447:14 )

这是什么意思?我知道在命令式代码中使用声明性代码不是一个好习惯,尽管我只是在尝试使用<b>Hello World</b>inng-bind-html指令。

0 投票
1 回答
420 浏览

angularjs - 如何使用 ng-bind 捕获 ng-model?

我无法从小部件中ng-bind="data1"捕获输入。ng-model="data1"通过单击并选择日期,ng-bind不会捕获所选日期。

0 投票
2 回答
3477 浏览

javascript - 如何使用量角器检索 ng-bind 的值

我是量角器的新手。

如何在量角器中使用 ng-bind 检索值 2?

0 投票
1 回答
520 浏览

javascript - AngularJS ng-bind 没有更新

我有一个 angularjs 应用程序可以正常工作,只是在ng-bind我更新范围值后 for 按钮不会更新:

0 投票
2 回答
1029 浏览

angularjs - 如何在 HTML 参数值中使用 ng-bind

我想在 AngularJS 中使用 ng-bind 指令而不是括号 {{ }}。我们有例子:

更改 value2 很容易。我们有:

我们如何更改{{value1}}以删除括号表示法?

DonJuwe 的第一个解决方案对我来说不正确。也许我做错了什么。例如在 HTML 中:

在控制器中:

单击按钮后,所有文本(1.、2.、3.)都是正确的,但只有第 1 行将颜色变为随机红色。

0 投票
1 回答
684 浏览

angularjs - ngBind 的 AngularJS“去抖动”

对于 ngModel 有一个 ngModelOptions 例如 ng-model-options="{ debounce: 1000 }"

ngBind 或有类似的东西{{}}吗?

基本上,我将一些数据绑定到一个 div 元素,ng-bind并且作为 Angular.js 的默认行为,数据在模型中更新后立即在 div 元素上更新。每当模型中的数据发生变化时,我想延迟 div 上的更新或数据绑定。这样,当模型($scope)中的数据发生变化时,这种变化应该只在 div 元素上 2 秒后才会出现。如何使这项工作?

0 投票
1 回答
3523 浏览

angularjs - How to bind input type='date' with angularjs

so I am trying to bind value for input of type date..

Here is my AngularJS code that I am trying to bind the value to:

And html:

What I am trying to do, is I am trying to set default value to todays date. However, when I am loading my page, it just gives me following result:

Any help will be more than welcome :)

Thanks, uksz