ANGULARJS create prompt angularjs - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

create prompt using angularjs


 292

ANGULARJS


2

// index.html

<!doctype html>
<html ng-app="ng_app">

<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>
<script src="http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="/script.js"></script>
</head>

<body>

<div ng-controller="ng_cont">
<div ng-repeat="item in items">
{{item.value}}
<button class="btn btn-small" ng-click="prompt(item)">prompt</button>
</div>
</div>
</body>

</html>

// script.js

angular.module('ng_app', ['ui.bootstrap']);

function ng_cont($scope, $dialog) {

$scope.items = [
{value: 'angularjs'},
];

var dialogOptions = {
controller: 'promptCtrl',
templateUrl: '/template.html'
};

$scope.prompt = function(item){

var itemToprompt = item;

$dialog.dialog(angular.extend(dialogOptions, {resolve: {item: angular.copy(itemToprompt)}}))
.open()
.then(function(result) {
if(result) {
angular.copy(result, itemToprompt);
}
itemToprompt = undefined;
});
};
}

function promptCtrl($scope, item, dialog){

$scope.item = item;

$scope.save_value = function() {
dialog.close($scope.item);
};

$scope.close = function(){
dialog.close(undefined);
};

}

// template.html

<div class="modal-header">
<h1>prompt {{item.name}}</h1>
</div>
<div class="modal-body">
<p><input ng-model="item.value" /></p>
</div>
<div class="modal-footer">
<button ng-click="save_value()" class="btn btn-primary" >Save</button>
<button ng-click="close()" class="btn" >close</button>
</div>


By     Created   
The power of the user (%)
5%



The most helpful ANGULARJS solutions

How to get client ip address using angularjs ?How to get client ip address using angularjs ?ANGULARJS

Click to see more ...

  10.1K     2.3K

How to get city from ip address with angularjs ?How to get city from ip address with angularjs ?ANGULARJS

Click to see more ...

  3.6K     1.3K

how to get client machine name and user name using angularjs ?how to get client machine name and user name using angularjs ?ANGULARJS

Click to see more ...

  3.3K     716

How to get local client ip address using angularjs ?How to get local client ip address using angularjs ?ANGULARJS

Click to see more ...

  2K     497

get client country using angularjs ?get client country using angularjs ?ANGULARJS

Click to see more ...

  1.3K     468

get region angularjsget region angularjsANGULARJS

Click to see more ...

  1.1K     410

How to get value from a href using angularjs ?How to get value from a href using angularjs ?ANGULARJS

Click to see more ...

  1K     366

how to fill a list from an another file in json format using angularjs ?how to fill a list from an another file in json format using angularjs ?ANGULARJS

Click to see more ...

  689     341

How to get keycode using angularjs ?How to get keycode using angularjs ?ANGULARJS

Click to see more ...

  544     149

get client time zone using angularjs get client time zone using angularjs ANGULARJS

Click to see more ...

  350     139