2) Adding UI logic: Controllers
How do I make an 2) adding ui logic: controllers?
Http://docs.angularjs.org/guide/concepts. What is a 2) adding ui logic: controllers? How do you make a 2) adding ui logic: controllers? This script and codes were developed by Ricardo on 24 September 2022, Saturday.
2) Adding UI logic: Controllers - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>2) Adding UI logic: Controllers</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet prefetch' href='https://docs.angularjs.org/components/bootstrap/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div ng-app="invoice1"> <div ng-controller="InvoiceController as invoice"> <b>Invoice:</b> <div> Quantity: <input type="number" ng-model="invoice.qty" required > </div> <div> Costs: <input type="number" ng-model="invoice.cost" required > <select ng-model="invoice.inCurr"> <option ng-repeat="c in invoice.currencies">{{c}}</option> </select> </div> <div> <b>Total:</b> <span ng-repeat="c in invoice.currencies"> {{invoice.total(c) | currency:c}} </span> <button class="btn" ng-click="invoice.pay()">Pay</button> </div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
2) Adding UI logic: Controllers - Script Codes JS Codes
angular.module('invoice1', []) .controller('InvoiceController', function() { this.qty = 1; this.cost = 2; this.inCurr = 'EUR'; this.currencies = ['USD', 'EUR', 'CNY']; this.usdToForeignRates = { USD: 1, EUR: 0.74, CNY: 6.09 }; this.total = function total(outCurr) { return this.convertCurrency(this.qty * this.cost, this.inCurr, outCurr); }; this.convertCurrency = function convertCurrency(amount, inCurr, outCurr) { return amount * this.usdToForeignRates[outCurr] * 1 / this.usdToForeignRates[inCurr]; }; this.pay = function pay() { window.alert("Thanks!"); }; });
Developer | Ricardo |
Username | ricardohu |
Uploaded | September 24, 2022 |
Rating | 3 |
Size | 2,033 Kb |
Views | 20,240 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Color Gradients with Less | 1,937 Kb |
Fashion celebrity container | 2,859 Kb |
Color Generator with LESS | 1,720 Kb |
Fashion celebrity container Bootstrap 2.3.2 | 2,894 Kb |
A Pen by Ricardo | 2,988 Kb |
Single Chat Window | 1,841 Kb |
RevContent Javascript Injection | 2,741 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Exploding Text | Jjmartucci | 4,749 Kb |
Animate a paper plane along an SVG path, looking ahead | PotatoDie | 3,734 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
Incremental game | Eprouver | 5,868 Kb |
Webkit decolorize | Fivera | 1,675 Kb |
Google Maps API Ground Overlay | Boycetrus | 2,961 Kb |
Atom | Bhlaird | 1,932 Kb |
Addthis_button | Esambino | 1,691 Kb |
HEXAGON | Aurumlux | 1,684 Kb |
Base64 SVG Me | MrBambule | 44,786 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!