gpt4 book ai didi

angularjs - Angular 修改元标记

转载 作者:行者123 更新时间:2023-12-04 06:19:19 24 4
gpt4 key购买 nike

我有一个元标记(苹果智能横幅),我想即时修改参数。但是,它目前不起作用:

我假设 ng-init 在创建头部之前被调用?如果是这样,我可以通过加载方法修改元数据吗?

这是html:

<!doctype html>
<html lang="en" ng-app="myApp" class="passWindowDimensions">
<head>
<meta charset="utf-8">
<title>XXXXXX</title>
<link rel="stylesheet" href="css/app.css"/>
<link rel="stylesheet" href="css/bootstrap.css"/>

<meta name="apple-itunes-app" content="app-id=XXXXXXX, app-argument = {{paramRId}}">

<!--Let search engines know we are a single page ajax app-->
<meta name="fragment" content="!">

<script src="js/JQuery.js"></script>
<script src="js/searchFunctions.js"></script>


</head>

部分的:
<div data-ng-init="loadMe()" div class="col-md-12 passWindowDimensions">

Controller :
/**
* Loading sequence. Loads the results
*/
$scope.loadMe = function(){

$scope.paramRId = 'test';


};

最佳答案

尝试服务和指令

http://jsfiddle.net/VnXYB/

module.factory("smartBanner", function() {
return {
appId: "",
appArgument: ""
}
});
module.directive("smartBanner",function(smartBanner){
return {
restrict: "E",
template: '<meta name="apple-itunes-app" content="app-id={{smartbanner.appId}}, app-argument = {{smartbanner.appArgument}}"></meta>',
replace: true,
link: function(scope) {
scope.smartbanner = smartBanner
}
}

});
module.controller("TestCtrl", function($scope,smartBanner){
$scope.update = function() {
smartBanner.appId=$scope.appId;
smartBanner.appArgument=$scope.appArgument;
};
});

关于angularjs - Angular 修改元标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20807761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com