2) Adding UI logic: Controllers

Developer
Size
2,033 Kb
Views
20,240

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 Previews

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!"); }; });
2) Adding UI logic: Controllers - Script Codes
2) Adding UI logic: Controllers - Script Codes
Home Page Home
Developer Ricardo
Username ricardohu
Uploaded September 24, 2022
Rating 3
Size 2,033 Kb
Views 20,240
Do you need developer help for 2) Adding UI logic: Controllers?

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!

Ricardo (ricardohu) Script Codes
Create amazing sales emails with AI!

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!