我有很少的JavaScript经验.我需要在点击项目时添加菜单.我们被要求从头开始构建它,而不使用任何库,如bootstrap compoments或JQuery.
我们正在使用Angularjs.在角度我想知道创建新元素的正确方法.像我们没有的东西document.createElement.
我正在为你们添加一些代码,以便更好地了解我想要做什么.
菜单指令
.directive('menu', ["$location","menuData", function factory(location, menuData) {
return {
templateUrl: "partials/menu.html",
controller: function ($scope, $location, $document) {
$scope.init = function (menu) {
console.log("init() called");
console.log("$document: " + $document);
if (menu.selected) {
$scope.tabSelected(menu);
}
}
$scope.creteMenu = function(menuContent){
//This is to be called when the action is an array.
}
$scope.tabSelected = function(menu){
$location.url(menu.action);
$scope.selected = menu;
}
$scope.click = function (menu) {
if (typeof (menu.action) == 'string') {
$scope.tabSelected(menu);
}
}
},
link: function …Run Code Online (Sandbox Code Playgroud) 我在Sharepoint 2013上有一个库,并使用以下代码检索所有参数(在客户端使用angularjs.).
var spListURL = siteURL + "_api/lists/getByTitle%28%27" + docLibName + "%27%29/items";
$http.get(spListURL,
{ headers: {"Accept": "application/json; odata=verbose", } }).success(function (result) {
dfd.resolve(result);
})
.error(function (data, status, headers, config) {
errorFactory.buildError(data, status, headers, ORIGIN_VIEW_NAME);
});
Run Code Online (Sandbox Code Playgroud)
但是,结果不包含文件名或文件URL.我需要创建一个指向该文件的锚链接.它确实包含我添加到List/Lib的自定义参数.
我之前从未使用过SharePoint.客户端代码是angularjs工厂的片段,它正在工作(就js而言是可以理解的).
我不想再使用一个休息呼叫d.result[index].File.__deffered.uri,然后在一个新的空白窗口中打开文档.
谢谢你的帮助.
我从未创建或编辑过CSS。
现在我正在使用引导程序,我想在具有不同颜色的多个场景中使用英雄单元。
我真的不想在原始CSS中编辑任何内容。我只想继承英雄单位,并用不同的颜色制作新的班级。
可能吗?