我是角度的首发,当我传递我输入文本框的值时,我能够在pageB[\dashboard]
的标题上看到text =“value”但是当我从一个页面路由到另一个页面时我无法在/*pageA*/
$rootScope.accNo = function() {
return $scope.AccountNumber;
}
/*pageB*/
$scope.showAccNo = function() {
return $scope.accno = $rootScope.accNo();
}
上看到相同的文字。我们的应用程序标题对于所有页面都是通用的。
<!-- `pageA` -->
<div class="col-md-12">
<input type="password" class="form-control" placeholder="#####" ng-model="AccountNumber"/>
</div>
<!-- `pageB` -->
<p >Administrator Portal for:<strong>{{showAccNo()}}</strong></p>
public static void essintial(string UserCorpus, string word)
{
// string str = "Alameer Ashraf Hassan Alameer ashraf,elnagar.";
string[] CorpusResult = UserCorpus.Split(' ', ',', '.');
//Creating the Dictionary to hold up each word as key & its occurance as Value ......!
Dictionary<string, int> Dict = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
//looping over the corpus and fill the dictionary in .........!
foreach (string item in CorpusResult)
{
if (item != "")
{
if (Dict.ContainsKey(item) == false)
{
Dict.Add(item, 1);
}
else
{
Dict[item]++;
}
}
}
//Console.WriteLine(Dict);
foreach (var item in Dict)
{
Console.WriteLine(item);
}
int ss = Dict[word];
Console.WriteLine(ss);
}
答案 0 :(得分:3)
您可以使用angularjs service
将值传递给其他控制器angular.module('myApp', [])
.service('sharedProperties', function () {
var AccountNumber;
return {
getProperty: function () {
return AccountNumber;
},
setProperty: function(value) {
AccountNumber= value;
}
};
});
function CtrlA($scope, sharedProperties) {
sharedProperties.setProperty($scope.AccountNumber);
}
function CtrlB($scope, sharedProperties) {
$scope.accno = sharedProperties.getProperty();
}
<!-- `pageA` -->
<div class="col-md-12">
<input type="password" class="form-control" placeholder="#####" ng-model="AccountNumber"/>
</div>
<!-- `pageB` -->
<p >Administrator Portal for:<strong>{{accno}}</strong></p>