I'm brand new creating AngularJS style code. I'm attempting to recreate an existing site in AngularJS format.
I finally figured out how to make an app/controller in an external file and give the controller functions. I can then have those functions return variables, particularly strings, to fill in information in my .html file, but when I use html tags, they are used as literals in the .html.
I'm trying to find out how to fill my html template in a similar manner, but with the html working.
In other JS formats, I can write to the document/response, or at least have the function return a value to then have the original JS/HTML write that return value as html.
I'm attempting something similar here in the footer, but the Footer() has a string that needs to be displayed on two lines.
Example code to follow (I'll edit it down to the important bits): HTML:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script language="JavaScript" src="./Universal.js" runat="server"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="./Main.css" rel="stylesheet" type="text/css">
</head>
<body id="idBody" ng-app="Universal">
<table id="idTableMain">
<tr id="idFooterRow">
<td id="idFooterMain" colspan="3">
<p id="idFooterContent" ng-controller="UniversalController">
{{Footer()}}
</p>
<p id="idFooterManagement" ng-controller="UniversalController">
{{WebMaster()}}
</p>
</td>
</tr>
</table>
</body>
</html>
App/Controller:
var Universal = angular.module("Universal", []);
Universal.controller("UniversalController", ['$scope', function ($scope)
{
$scope.Footer = function()
{
$scope.vResult = "© Copyright 2012 All rights reserved<br>";
$scope.vResult += "House That Kamurai Built";
return $scope.vResult;
};
$scope.WebMaster = function()
{
$scope.vResult = "Website managed by Kamurai.";
return $scope.vResult;
};
}]);