Currently in the process of developing an application using AngularJS, I am faced with the challenge of passing a URL when clicking on a menu button in order to utilize that URL within an iframe on another view controlled by a separate controller. Despite extensive efforts and scouring through resources like Stackoverflow, I have yet to find a solution to this issue.
Service:
module Services {
export class PassUrlService {
getUrl;
setUrl;
givenUrl;
constructor($scope) {
this.getUrl = function() {
return this.givenUrl;
}
this.setUrl = function (value: string) {
this.givenUrl = value;
}
}
}
}
Controller:
module Controllers {
export class MainController {
data = [];
sce;
IframeUrl;
constructor($scope, $sce) {
$scope.data = this.data;
$scope.vm = this;
this.sce = $sce;
}
setIframeUrl = function (url) {
this.IframeUrl = Services.PassUrlService.setUrl(this.sce.trustAsResourceUrl(url));
debugger;
}
}
}
Encountering the following error message:
error TS2339: Property 'setUrl' does not exist on type 'typeof PassUrlService'.
I am hopeful that someone out there can provide guidance on resolving this problem. Thank you in advance for your assistance!