Sass导入另一个sass文件中的部分内容(Sass import partial content in another sass file)
我想在我的新项目中使用sass,但我找不到更好的交叉文件使用方法。 这是一个例子
/*a.scss*/ @mixin mixA{ .... } .classInA{ ... } /*b.scss*/ @import 'a' ....
我想使用mixA而不将其他scss(例如classInA)导入到b.scss中,我该怎么办呢?
I would like to use sass in my new project, but I can't find a better way for cross file usage. Here is the example
/*a.scss*/ @mixin mixA{ .... } .classInA{ ... } /*b.scss*/ @import 'a' ....
I want to use the mixA without having other scss(such as classInA) being imported into b.scss, how can I do it?
原文:https://stackoverflow.com/questions/32963899
最满意答案
如果
http://localhost:58402/Search.svc/abc/ListsJava/Certification
已经返回您的JSON数据,那么您是否只能在success
回调中调用您的分页代码,如下所示:app.controller('CertificationCtrl', function ($scope, ngTableParams, $http) { var url = "http://localhost:58402/Search.svc/abc/ListsJava/Certification"; $http.get(url) .success(function (data) { $scope.tableParams = new ngTableParams( { page: 1, // show first page count: 5 // count per page }, { total: data.length, // length of data getData: function ($defer, params) { $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count())); } }); }); });
UPDATE
请参阅jsfiddle上的现场演示。 不要担心Javascript部分中的第1行到第10行; 我用它来设置要发送到jsfiddle echo服务的测试数据。 将第11行的
url
变量替换为您的URL。另外,请注意我使用
$http.post
进行演示,并且还删除了所有JSON.parse()
代码。If
http://localhost:58402/Search.svc/abc/ListsJava/Certification
is already returning your JSON data, can't you just call your pagination codes in yoursuccess
callback like this:app.controller('CertificationCtrl', function ($scope, ngTableParams, $http) { var url = "http://localhost:58402/Search.svc/abc/ListsJava/Certification"; $http.get(url) .success(function (data) { $scope.tableParams = new ngTableParams( { page: 1, // show first page count: 5 // count per page }, { total: data.length, // length of data getData: function ($defer, params) { $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count())); } }); }); });
UPDATE
Refer live demo on jsfiddle. Don't worry about line 1 to 10 in the Javascript section; I used that to set up the test data to be sent to jsfiddle echo service. Replace the
url
variable on line 11 with your URL.Also, note that I am using
$http.post
for demonstration, and have also removed all yourJSON.parse()
codes.
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
你的data2是无效的 JSON字符串。 它应该是: data2 = "{\"title\":\"1111111\",\"start\":\"2014-03-23T16:00:00.000\",\"end\":\"2014-03-23T18:00:00.000\",\"id\":107,\"hdtid\":1,\"color\":\"#c732bd\",\"allDay\":false,\"description\":\"\"}" 请阅读JSON标准http://json.org JSON比纯javasc ...
-
我希望我的json存储在我的控制器中的字符串变量中(I want my json to be stored in a string variable in my controller)[2023-06-29]
如果http://localhost:58402/Search.svc/abc/ListsJava/Certification已经返回您的JSON数据,那么您是否只能在success回调中调用您的分页代码,如下所示: app.controller('CertificationCtrl', function ($scope, ngTableParams, $http) { var url = "http://localhost:58402/Search.svc/abc/ListsJava/Certific ... -
您已经有了一个字符串,因此不需要使用JSON.stringify 。 只需使用以下代码: var staticData = '{"someKey":"someValue", "masterJobs":[]}'; //very large json string. $scope.staticTestData = JSON.parse(staticData); console.log($scope.staticTestData.masterJobs); You already have a string, s ...
-
为什么我的JQuery函数将空JSON字符串POST到我的控制器?(Why is my JQuery function POSTing a null JSON string to my controller?)[2022-05-25]
为什么不将控制器中的参数定义为对象并让序列化程序映射对象而不是发送字符串? public ActionResult DismissAttendeeFromAllClasses(IEnumerablejson) { //Do stuff } 编辑: 在发送集合时,您应该相应地更新控制器。 在请求中还包括contentType: "application/json; charset=utf-8" The parameter name in the JQuery post f ... -
反序列化存储在字符串变量中的Json String(Deserializing Json String which is stored in a string variable)[2022-01-19]
JArray.Parse不起作用,因为你没有json数组,它是一个对象。 此外,该对象的所有值都不是集合,例如, location也是对象,而不是集合。 你有一些解析它的选项 将根对象解析为Dictionary JsonConvert.DeserializeObject>(wsjson) 然后,如果value是数组,则将字典的每个值解析为数组;如果value是object,则将字典解析为字典。 根据您的json数据创建一个C#类,并将字符串直接解析为该 ... -
您需要添加标头,指示发送的信息是json类型。 因此,将以下哈希添加到fetch指令中; headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, 然后你可以删除.replace(/{|}/gi, "") ,这只是一个解决你没有指定数据是json的事实。 最终代码应如下所示: fetch(POST_PAID_UP, { method: 'POST', headers: { ...
-
我想将存储在变量中的数据从一个控制器共享到另一个控制器(I want to share data stored in variable from one controller to another)[2022-04-11]
在'app.toolbar'模块中编写服务 angular.module('app.toolbar').service('ServiceA', function() { this.getValue = function() { return this.myValue; }; this.setValue = function(newValue) { this.myValue = newValue; } }); 在您的too ... -
你要么让控制器接收一个对象而不是一个字符串并传递 { 'firstField': i, 'secondField': j, 'thirdField': k } 或尝试控制器签名 public JsonResult searchdata(List
firstField, List secondField, List thirdField) 并通过使用GET而不是AJAX帖子将以下内容附加到URL来调用 "?firstField=" + JSON.st ... -
如您所见,您没有为第三个对象定义任何emailAddress。 如果您不确定JSON中是否包含所有属性,则必须先检查密钥。 if (jsonObject.has(TAG)) { jsonObject.getString(TAG_ID); } 有些时候我使用utils来使代码更容易,例如: public static String getString(JSONObject object, String tag, String defString) { if (object.has(tag)) ...