我正在分配的ng-model可以在modal中看到.但是当我更新模态中的数据时,$ scope变量没有更新.还有下拉列表无效,我在控制器中定义了它的值.我是否需要在指令中进行更改.
<div ng-controller="MainCtrl" class="container">
<h1>Modal example</h1>
<button ng-click="toggleModal()" class="btn btn-default">Open modal</button>
<modal title="Login form" visible="showModal">
<div>
<select ng-model="client" ng-change="changeClient()" ng-options="item in clientList">
<label for="email">Email address</label>
<input type="text" ng-model="email" id="email" placeholder="Enter email" />
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Password" />
</div>
<button type="submit" ng-click="buttonClicked()" class="btn btn-default">Submit</button>
</modal>
</div>
Run Code Online (Sandbox Code Playgroud)
控制器代码
var mymodal = angular.module('mymodal', []);
mymodal.controller('MainCtrl', function ($scope) {
$scope.email="hello@abc.com";
$scope.showModal = false;
$scope.toggleModal = function(){
$scope.showModal = !$scope.showModal;
};
$scope.buttonClicked=function(){
alert("hello1");
alert($scope.email);
alert($scope.client);
}
$scope.clientList=["300","600","900"]
$scope.client=$scope.clientList[0];
$scope.changeClient …Run Code Online (Sandbox Code Playgroud) 我使用Ionic 2构建了一个应用程序.当我在浏览器中运行它时,UI看起来不错,但是一旦我在iOS模拟器中运行,一切看起来都很笨重.问题在于状态栏.我需要隐藏状态栏.我尝试使用离子原生的StatusBar,像这样 -
import {StatusBar} from 'ionic-native';
constructor(platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.hide();
//StatusBar.styleDefault();
});
Run Code Online (Sandbox Code Playgroud)
但实际上它没有隐藏状态栏,而是它只是覆盖状态栏颜色与我的页面标题颜色.隐藏状态栏的任何解决方案.
我想改变已经具有backkground颜色的div的背景颜色,该颜色对于奇数元素是白色而对于偶数元素是灰色.不知道为什么它不在Jsfiddle工作.div也有一个ng-click,我没有在JSfiddle示例中使用过.我想改变被点击为黄色的div的颜色.这是JsFiddle Link .... LINK
基本守则 -
<div ng-app="myApp">
<div ng-controller='Ctrl'>
<div ng-repeat='item in jsonContacts' ng-style='{"left":($last?lastX:null)+"px","top":($last?lastY:null)+"px"}'>{{item}}</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)