In: Computer Science
You first needs to create a file called “myJS.js” in your project directory. Then, include the AngularJS library and myJS.js in the header of the index.html page. Now, you need to define your angular application and a controller in this file such that the controller has the following variables with these initial values:
name = "Alex Cool";
faculty= "Faculty of Busienss and IT";
university = {name:"University of Ontario Institute of Technology",
url:"http://www.uoit.ca"};
contacts = {email:"[email protected]", phone:"xxx-xxx-xxxx"};
skills = [
{name: "Web Security",
text: "I am so great in web security."},
{name: "Typing with my toes",
text: "I can type 500 words in a minute with my toes!!!"} ];
prog_skills = ["C++", "Java", "Python"];
courses = [
{ name : "Web Programming",
number: "INFR 3120",
time:["Monday 2:10--3:30",
"Wednesday 2:10--3:30"],
instructor: "Amirali Abari"
},
{
name : "Web Programming",
number: "INFR 3120",
time:["Monday 11:10--12:30",
"Wednesday 11:10--12:30"],
instructor: "Amirali Abari"
},
{
name : "Best Programming",
number: "INFR 3120",
time:["Monday 2:10--3:30",
"Wednesday 2:10--3:30"],
instructor: "Amirali Abari"
}
];
You should edit the values of these variables to include your own information. Also, you need to slightly change the name of these variables when you are putting them in your Angular controller (Hint: remember $scope). Now modify the code of your index.html to use these variables. Some specific tasks follow:
Your name on top of the page, in contact section, and bottom of the page all come from the “name” variable defined above.
All contact Information about faculty, university, email address, and phone number should come from their relevant variables.
Your professional skills heading (i.e., the bold part) and their explanation should come from the “skills” variable. Hint: use ng-repeat.
Programming skills should come from the prog skills variable. Hint: use ng-repeat.
The content of course schedule table should come from the array of courses. Hint: use ng-repeat and also you might need to useto iterate over two rows.
Define events for your table such that if each header of column is clicked, then all rows are ordered by that column.
Index HTML
<!DOCTYPE html>
<html>
<head>
<title>Siba Lalik's Webpage</title>
<link rel="stylesheet" href="mycss.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1">
</head>
<body>
<div class="header">
Siba Lalik's Webpage
</div>
<div class="topnav">
<a href="#contact">Contacts</a>
<a href="#about">About me</a>
<a href="#programming">Programming</a>
<a href="#professional">Professional</a>
<a href="#schedules">Schedules</a>
</div>
<div class="row">
<div class="column half">
<img src = "IMG_5425.jpeg" ></td>
</div>
<div class="column half">
<h2 style="margin:0;" id="contact">Contacts</h2>
Hiba Malik<br>
Faculty of Busienss and IT <br>
<a href = "https://www.ontariotechu.ca">Ontario
TechU</a><br>
Email address: [email protected] <br>
Phone number: 5472622926 <br>
</div>
</div>
<div class="row">
<div class="column side">
<h2 id="about">About Hiba</h2>
<p>
My name is Siba Lalik. I am in my second year at OTU. I tested
positive for COVID in March and recovered, that is my story.
<br> It feels odd to write just one sentence when I have a
whole webpage available to work with.
<br> I like to write, hike and paint.
<br> I own a cat. I am not very good at programming but I
try.
</p>
</div>
<div class="column middle">
<h2 id="professional"> Professional Skills </h2>
<ol type= "i">
<li><strong>Operating Systems:</strong> I can
download Windows on my MacBook with no assistance.</li>
<li><strong>Project Management:</strong> I put
together the daily worksheets with everyone's tasks at
work.</li>
<li><strong>Leadership:</strong> I always walk in
front of everyone.</li>
<li><strong>Communications and Negotiation
Expert:</strong> In short, I love to talk but not more than I
love to be right.</li>
</ol>
</p>
</div>
<div class="column side">
<h2 id="programming"> Programming Skills </h2>
<ul style="list-style-type: square">
<li>C++</li>
<li>Java</li>
<li>Ruby</li>
<li>HTML</li>
</ul>
</p>
</div>
<div class="row">
<div class="column" style="width:100%">
<h2 id="schedules"> Course Schedules </h2>
<p>Here is the table of courses that I take this
semester.</p>
<table>
<tr>
<th>Course name</th>
<th>Course number</th>
<th> Days and Time </th>
<th> Instructor </th>
</tr>
<td rowspan = "2"><strong> Web
programming</td>
<td rowspan = "2"> INFR 3120</td>
<td rowspan = "1"> Monday 2:10--3:30</td>
<td rowspan = "2"> Amirali Abari</td>
</tr>
<tr>
<td rowspan = "1"> Wednesday 2:10--3:30</td>
</tr>
<td rowspan = "2"><strong> Statistics</td>
<td rowspan = "2"> INFR 1450</td>
<td rowspan = "1"> Wednesday 5:10--8:30</td>
<td rowspan = "2"> Amir Rastpour</td>
</tr>
<tr>
<td rowspan = "1"> Friday 2:10--5:10</td>
</tr>
<td rowspan = "2"><strong> Intro to
Entrepreneurship</td>
<td rowspan = "2"> BUSI 1700</td>
<td rowspan = "1"> Friday 3:40--6:30</td>
<td rowspan = "2"> Jeffrey Overall</td>
</tr>
</table>
</div>
<div class="footer">
<p>Designed by Siba @ 2020</p>
</div>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Siba Lalik's Webpage</title>
<link rel="stylesheet" href="mycss.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script type="text/javascript" src="myJS.js"></script
</head>
<body ng-app="sampleApp" ng-controller="mainCtrl">
<div class="header">
{{name}}'s Webpage
</div>
<div class="topnav">
<a href="#contact">Contacts</a>
<a href="#about">About me</a>
<a href="#programming">Programming</a>
<a href="#professional">Professional</a>
<a href="#schedules">Schedules</a>
</div>
<div class="row">
<div class="column half">
<img src = "IMG_5425.jpeg" ></td>
</div>
<div class="column half">
<h2 style="margin:0;" id="contact">Contacts</h2>
{{name}}<br>
{{faculty}} <br>
<a href = {{university.url}}>{{university.name}}</a><br>
Email address: {{contacts.email}} <br>
Phone number: {{contacts.phone}} <br>
</div>
</div>
<div class="row">
<div class="column side">
<h2 id="about">About {{name}}</h2>
<p>
My name is {{name}}. I am in my second year at OTU. I tested positive for COVID in March and recovered, that is my story.
<br> It feels odd to write just one sentence when I have a whole webpage available to work with.
<br> I like to write, hike and paint.
<br> I own a cat. I am not very good at programming but I try.
</p>
</div>
<div class="column middle">
<h2 id="professional"> Professional Skills </h2>
<ol type= "i">
<li ng-repeat="mySkill in skills"><strong>{{mySkill.name}}:</strong> {{mySkill.text}}</li>
</ol>
</div>
<div class="column side">
<h2 id="programming"> Programming Skills </h2>
<ul style="list-style-type: square">
<li ng-repeat="skill in prog_skills">{{skill}}</li>
</ul>
</p>
</div>
<div class="row">
<div class="column" style="width:100%">
<h2 id="schedules"> Course Schedules </h2>
<p>Here is the table of courses that I take this semester.</p>
<table>
<thead>
<tr>
<th ng-click="orderByColumn='name'">Course name</th>
<th ng-click="orderByColumn='number'">Course number</th>
<th ng-click="orderByColumn='time'"> Days and Time </th>
<th ng-click="orderByColumn='instructor'"> Instructor </th>
</tr>
</thead>
<tbody ng-repeat="course in courses | orderBy: orderByColumn">
<tr ng-repeat="(index,time) in course.time">
<td ng-if="index===0" rowspan = "2"><strong> {{course.name}}</td>
<td ng-if="index===0" rowspan = "2"> {{course.number}}</td>
<td rowspan = "1"> {{time}}</td>
<td ng-if="index===0" rowspan = "2"> {{course.instructor}}</td>
</tr>
</tbody>
</table>
</div>
<div class="footer">
<p>Designed by {{name}} @ 2020</p>
</div>
</body>
</html>
JS:
var app = angular.module('sampleApp', []);
app.controller('mainCtrl', function($scope) {
$scope.name = "Alex Cool";
$scope.faculty= "Faculty of Busienss and IT";
$scope.university = {
name:"University of Ontario Institute of Technology",
url:"http://www.uoit.ca"
};
$scope.contacts = {
email:"[email protected]",
phone:"xxx-xxx-xxxx"
};
$scope.skills = [
{
name: "Web Security",
text: "I am so great in web security."
},
{
name: "Typing with my toes",
text: "I can type 500 words in a minute with my toes!!!"
}
];
$scope.prog_skills = ["C++", "Java", "Python"];
$scope.courses = [
{
name : "Web Programming",
number: "INFR 3120",
time:["Monday 2:10--3:30","Wednesday 2:10--3:30"],
instructor: "Amirali Abari"
},
{
name : "Web Programming",
number: "INFR 3120",
time:["Monday 11:10--12:30","Wednesday 11:10--12:30"],
instructor: "Amirali Abari"
},
{
name : "Best Programming",
number: "INFR 3120",
time:["Monday 2:10--3:30","Wednesday 2:10--3:30"],
instructor: "Amirali Abari"
}
];
$scope.orderByColumn="";
});
Please take a look on the code and feel free to ask in comment section if you have any doubts. Thanks!