【Angular.JS利用ng-disabled属性和ng-model实现禁用button效果】教程文章相关的互联网学习教程文章

javascript – 具有多个变量的Angularjs ng-repeat过滤器属性?【代码】

我正在尝试类似的东西<ion-item class="item-icon-right " ng-repeat="project in jsonObj.Projects | filter:projectArea:true:ProjectStatus" type="item-text-wrap" ui-sref="tabs.detail({project:project['Project name']})"><div class="row"><div class="col col-45"><h2>{{project["Project name"]}}</h2><h4>{{project["PM"]}}</h4></div><div class="col col-45"></div><div class="col col-10"><span class="badge badg...

javascript – AngularJS按属性和自定义过滤器排序【代码】

我已经看到很多答案和文档,表明你可以将一组属性名称传递给Angular的orderBy过滤器,以便按多个字段排序.但是,我的一个对象属性是存储为文本的数字(字段可以是“100”,“75”,“50”或“< 25”).为了将这些值排序为数字,我一直在使用: <div ng-repeat="item in items | orderBy:sortFunction">{{item.itemStatus}} - {{item.itemLevel}} </div>//Function in controller... $scope.sortFunction = function(item) {return parseInt...

javascript – AngularJs为什么更新属性比更新varibale更好?【代码】

来自“ng-book”,它说:Due to the nature of JavaScript itself and how it passes by value vs. reference, it’s considered a best-practice in Angular to bind references in the views by an attribute on an object, rather than the raw object itself.…..In this case, rather than updating the $scope.clock every second, we can update the clock.now property. With this optimization, we can….我不知道为什么,因...

java – 如何从spring控制器获取angularjs中的模型属性值【代码】

我将弹簧控制器定义为@Controller public class TestController {private Logger logger = LoggerFactory.getLogger(getClass());@RequestMapping(value="/hello")public String home(HttpServletRequest httpRequest, Model model) { model.addAttribute("Authorization", "test string");return "/index";} }有没有办法在angularjs控制器中获得属性“授权”?解决方法:试试这个: ($location.search()).授权 有关$locat...

javascript – 在Angular中读取属性文件值【代码】

我已经对使用$http服务访问属性文件做了一些回复,但现在确定它在这种情况下是如何适应的我已经创建了一个从poperties文件返回主机名的服务,该服务的调用客户端应该对服务进行阻塞调用,并且只有在读取属性文件时才继续.var serviceMod = angular.module('serviceModule',[]) .factory('configService', function($http){return {getValue: function(key){$http.get("js/resources/urls.properties").success(function(response){con...

javascript – TypeError:无法使用AngularJs读取IONIC中未定义的属性’googleplus’【代码】

我一直在关注这些链接,在我的混合应用程序中使用社交登录. https://github.com/EddyVerbruggen/cordova-plugin-googleplus https://ionicthemes.com/tutorials/about/google-plus-login-with-ionic-framework 我创建了所有谷歌开发者ID和所有这些东西.正如他们所说,我已经使用这两个安装了cordova-plugin-googleplus.但仍然我的应用程序显示我提到的错误作为此消息的标题…In this line: window.plugins.googleplus.login(所以,请...

javascript – Angular 2 – Http-Testing – 错误:“无法读取属性’getCookie’的null”【代码】

在以下代码中使用karma运行Jasmine Tests时,总是在控制台中出现此错误: 错误:TypeError: Cannot read property ‘getCookie’ of null服务://http.service.ts import {Injectable, Inject, ReflectiveInjector} from '@angular/core'; import {Headers, Http, Response, HTTP_PROVIDERS} from '@angular/http';import {Observable} from "rxjs";const injector = ReflectiveInjector.resolveAndCreate(HTTP_PROVIDERS); cons...

javascript – Angular – 属性绑定高度和宽度不适用于Image【代码】

我试图在Angular中做一个属性绑定的例子.我决定拍摄一张图片,然后通过属性绑定放置它的所有3个属性 – width,height,src.令我惊讶的是,尽管没有错误,并且图像由URL呈现(url中没有错误),但宽度和高度仍然呈现为零(0).为什么这个?据我所知,Image将高度和宽度作为其属性.那么问题出在哪里? abc.component.html//This does not work - gives height:0px, width:0px <img [width]="'100px'" [height]="'100px'" [src]="'./assets/img...

javascript – 使用angularjs在每次点击时更改css属性【代码】

检查这个Link,我试图在每次用户点击Button时更改保证金.我能够改变背景属性,不知道Margin属性出了什么问题. 这是我想要实现的目标: >每次点击都应修改保证金,而不仅仅是一次.所以在第一次点击时如果我的左边距是20px,在第二次点击它将是40px,依此类推.>达到特定边距(即200px)后,按钮应消失/禁用. 我知道这可以做到,但是因为我是刚开始想要的角色吗? HTML<!DOCTYPE html> <html><head><link rel="stylesheet" href="style.css"><s...

javascript – 为什么Angular在正确更新模型时,通过在ng-options中为标记添加“selected”属性来更新DOM?【代码】

当我构建一个< select>时使用Angular 1.2.29如果选择一个选项,模型会更新,并且在视觉上< select>表示已选择新选择的选项. 但是,当使用开发人员工具查看标记时,我可以看到选项标记未更新,具体而言,所选属性不会从先前选择的选项中删除,也不会添加到新选择的选项中.<div data-ng-controller="MainController as main"><pre> {{ main.test.item }} </pre><selectdata-ng-model="main.test.item"data-ng-options="item.label for item ...

javascript – AngularJS – 将ngModel绑定到存储在属性中的对象【代码】

我试图以编程方式填充输入列表. 我有类似的东西<div ng-repeat="field in fields"> <input ng-model="field.Binding" /> </div>var Query = {Keywords: "Foo",Title: "Bar" }var Fields = [{Name: "Keywords",Binding: Query.Keywords }, {Name: "Title",Binding: Query.Title }];var myApp = angular.module('myApp', []);function MyCtrl($scope) {$scope.fields = Fields;$scope.query = Query; }非工作小提琴@ http://jsfiddle...

javascript – 在angular js smart-table中按多个布尔属性过滤【代码】

我有以下情况:指标列表,每个指标都具有属性名称,描述,基本和差异.$scope.indicators = [{ name: 'indicator1' , description: 'blah1', essential: true, differential: false },{ name: 'indicator2' , description: 'blah2', essential: false, differential: true },{ name: 'indicator3' , description: 'blah3', essential: true, differential: true },{ name: 'indicator4' , description: 'blah4', essential: false, dif...

javascript – AngularJS中的oninput事件属性【代码】

我正在构建一系列输入字段,这些字段会在达到最大长度时自动显示.这通过检查ng-keyup事件上的值的长度来工作,但这有一个小问题,可以通过使用oninput事件来解决.但是,Angular似乎没有出现这种情况? 我正在努力解决的问题: 当我快速输入最大字符数(在我的情况下是两位数,可以很快输入)时,第一个键盘在输入两个字符后触发,并标记到下一个字段.第二个keyup仅在tabbing之后注册,因此它会在下一个字段上触发.这会导致不必要的行为 要重现...

javascript – 如何访问Angular表单元素的属性【代码】

假设我们有某种形式<form name="myForm" data-ng-controller="Ctrl"><input name="input" data-ng-model="userType" data-description="User Type" required> </form>在控制器中,我们可以通过代码访问该输入元素$scope.myForm.userType但是我们如何获得这个元素的data- *属性呢?解决方法:您可以使用:angular.element(selector).attr("data-description")像使用jQuery一样选择元素.

javascript – Angular 6:类型’typeof Observable’上不存在属性’fromEvent’【代码】

我正在为angular 6应用程序创建粘性标头的粘性导航栏指令 这是我到目前为止:import { Directive, Input, Renderer, ElementRef, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { fromEvent } from 'rxjs';@Directive({selector: '[ngStickyNav]' })export class StickyNavDirective implements OnInit {private offsetTop: number;private lastScroll: number = 0;private isSticky: boolean = fals...